리자

[펌] JPEG EXIF 정보 얻는 함수(read_exif_data 사용 안함)

JPEG의 이미지 metadata 정보를 얻어오는 클래스 라이브러리 입니다.
PHP에서 제공하는 exif관련 함수를 전혀 사용하지 않고 hexData를 분석하여 추출해 내므로 별도의 EXIF 관련 외부 라이브러리를 설치하지 않으셔도 이용하실 수 있습니다.

사용하는 법은 아래와 같습니다.

<?php
$exif = new exif('image.jpg');

print_r($exif ->getImageInfo());
?>

exif::exif() 함수로 읽어올 이미지 파일을 설정한후
exif::getImageInfo() 함수로 해당 이미지의 EXIF 및 기타 모든 정보를 리턴받습니다.




- 클래스 설명
- exif class
*exif::exif("(string)파일경로", "(string)언어설정(en|ko)", "(boolen)디버그 정보 출력여부");
*exif::getImageInfo(void);


라이센스는 기본 MIT 을 따릅니다.
Copyright (c) 2010 M_FireFox

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>

첨부파일

exif.php (28.2 KB) 22회 2010-09-30 22:03
|

댓글 5개

PHPINFO 에서 EXIF Support enabled 인 경우에는 exif_read_data() 함수를 사용하시면 됩니다.
http://sir.co.kr/bbs/board.php?bo_table=ds_free_image&wr_id=6011
위 링크의 이미지를 exif() 함수로 출력한 결과

Array
(
[format] => JPEG
[version] =>
[width] => 800
[height] => 533
[bpp] => 24
[alpha] =>
[exif] => Array
(
[Make] => Canon
[Model] => Canon EOS 450D
[Orientation] => 1
[XResolution] => 72
[YResolution] => 72
[ResolutionUnit] => 2
[Software] => Adobe Photoshop CS4 Windows
[DateTime] => 2010:09:23 21:21:45
[YCbCrPositioning] => 2
[ExifIFDPointer] => 220
[ExposureTime] => 0.025
[FNumber] => 20
[ExposureProgram] => 조리개 우선
[ISOSpeedRatings] => 200
[ExifVersion] => 0221
[DateTimeOriginal] => 2010:09:23 14:05:13
[DateTimeDigitized] => 2010:09:23 14:05:13
[ComponentsConfiguration] => Y
[ShutterSpeedValue] => 5.375
[ApertureValue] => 8.625
[ExposureBias] => 0.33333333333333
[MeteringMode] => 패턴
[Flash] => 강제 플래시 끔
[FocalLength] => 50
[UserComment] => Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 0
[8] => 0
[9] => 0
[10] => 0
[11] => 0
[12] => 0
[13] => 0
[14] => 0
[15] => 0
[16] => 0
[17] => 0
[18] => 0
[19] => 0
[20] => 0
[21] => 0
[22] => 0
[23] => 0
[24] => 0
[25] => 0
[26] => 0
[27] => 0
[28] => 0
[29] => 0
[30] => 0
[31] => 0
[32] => 0
[33] => 0
[34] => 0
[35] => 0
[36] => 0
[37] => 0
[38] => 0
[39] => 0
[40] => 0
[41] => 0
[42] => 0
[43] => 0
[44] => 0
[45] => 0
[46] => 0
[47] => 0
[48] => 0
[49] => 0
[50] => 0
[51] => 0
[52] => 0
[53] => 0
[54] => 0
[55] => 0
[56] => 0
[57] => 0
[58] => 0
[59] => 0
[60] => 0
[61] => 0
[62] => 0
[63] => 0
[64] => 0
[65] => 0
[66] => 0
[67] => 0
[68] => 0
[69] => 0
[70] => 0
[71] => 0
[72] => 0
[73] => 0
[74] => 0
[75] => 0
[76] => 0
[77] => 0
[78] => 0
[79] => 0
[80] => 0
[81] => 0
[82] => 0
[83] => 0
[84] => 0
[85] => 0
[86] => 0
[87] => 0
[88] => 0
[89] => 0
[90] => 0
[91] => 0
[92] => 0
[93] => 0
[94] => 0
[95] => 0
[96] => 0
[97] => 0
[98] => 0
[99] => 0
[100] => 0
[101] => 0
[102] => 0
[103] => 0
[104] => 0
[105] => 0
[106] => 0
[107] => 0
[108] => 0
[109] => 0
[110] => 0
[111] => 0
[112] => 0
[113] => 0
[114] => 0
[115] => 0
[116] => 0
[117] => 0
[118] => 0
[119] => 0
[120] => 0
[121] => 0
[122] => 0
[123] => 0
[124] => 0
[125] => 0
[126] => 0
[127] => 0
[128] => 0
[129] => 0
[130] => 0
[131] => 0
[132] => 0
[133] => 0
[134] => 0
[135] => 0
[136] => 0
[137] => 0
[138] => 0
[139] => 0
[140] => 0
[141] => 0
[142] => 0
[143] => 0
[144] => 0
[145] => 0
[146] => 0
[147] => 0
[148] => 0
[149] => 0
[150] => 0
[151] => 0
[152] => 0
[153] => 0
[154] => 0
[155] => 0
[156] => 0
[157] => 0
[158] => 0
[159] => 0
[160] => 0
[161] => 0
[162] => 0
[163] => 0
[164] => 0
[165] => 0
[166] => 0
[167] => 0
[168] => 0
[169] => 0
[170] => 0
[171] => 0
[172] => 0
[173] => 0
[174] => 0
[175] => 0
[176] => 0
[177] => 0
[178] => 0
[179] => 0
[180] => 0
[181] => 0
[182] => 0
[183] => 0
[184] => 0
[185] => 0
[186] => 0
[187] => 0
[188] => 0
[189] => 0
[190] => 0
[191] => 0
[192] => 0
[193] => 0
[194] => 0
[195] => 0
[196] => 0
[197] => 0
[198] => 0
[199] => 0
[200] => 0
[201] => 0
[202] => 0
[203] => 0
[204] => 0
[205] => 0
[206] => 0
[207] => 0
[208] => 0
[209] => 0
[210] => 0
[211] => 0
[212] => 0
[213] => 0
[214] => 0
[215] => 0
[216] => 0
[217] => 0
[218] => 0
[219] => 0
[220] => 0
[221] => 0
[222] => 0
[223] => 0
[224] => 0
[225] => 0
[226] => 0
[227] => 0
[228] => 0
[229] => 0
[230] => 0
[231] => 0
[232] => 0
[233] => 0
[234] => 0
[235] => 0
[236] => 0
[237] => 0
[238] => 0
[239] => 0
[240] => 0
[241] => 0
[242] => 0
[243] => 0
[244] => 0
[245] => 0
[246] => 0
[247] => 0
[248] => 0
[249] => 0
[250] => 0
[251] => 0
[252] => 0
[253] => 0
[254] => 0
[255] => 0
[256] => 0
[257] => 0
[258] => 0
[259] => 0
[260] => 0
[261] => 0
[262] => 0
[263] => 0
)

[SubsecTime] => 03
[SubsecTimeOriginal] => 03
[SubsecTimeDigitized] => 03
[FlashpixVersion] => 0100
[ColorSpace] => 1
[PixelXDimension] => 800
[PixelYDimension] => 533
[InteroperabilityIFDPointer] => 956
[FocalPlaneXResolution] => 2569.4760820046
[FocalPlaneYResolution] => 2575.3424657534
[FocalPlaneResolutionUnit] => 2
[CustomRendered] => Normal process
[ExposureMode] => 0
[WhiteBalance] => 자동
[SceneCaptureType] => 일반
)

)
http://sir.co.kr/bbs/board.php?bo_table=ds_free_image&wr_id=6011
위 링크의 이미지를 exif_read_data() 함수로 출력한 결과


Array
(
[FileName] => image.jpg
[FileDateTime] => 1285852662
[FileSize] => 164800
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP
[COMPUTED] => Array
(
[html] => width="800" height="533"
[Height] => 533
[Width] => 800
[IsColor] => 1
[ByteOrderMotorola] => 0
[CCDWidth] => 7mm
[ApertureFNumber] => f/20.0
[UserComment] =>
[UserCommentEncoding] => UNDEFINED
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
)

[Make] => Canon
[Model] => Canon EOS 450D
[Orientation] => 1
[XResolution] => 720000/10000
[YResolution] => 720000/10000
[ResolutionUnit] => 2
[Software] => Adobe Photoshop CS4 Windows
[DateTime] => 2010:09:23 21:21:45
[YCbCrPositioning] => 2
[Exif_IFD_Pointer] => 220
[THUMBNAIL] => Array
(
[Compression] => 6
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 1082
[JPEGInterchangeFormatLength] => 6141
)

[ExposureTime] => 1/40
[FNumber] => 20/1
[ExposureProgram] => 3
[ISOSpeedRatings] => 200
[ExifVersion] => 0221
[DateTimeOriginal] => 2010:09:23 14:05:13
[DateTimeDigitized] => 2010:09:23 14:05:13
[ComponentsConfiguration] =>
[ShutterSpeedValue] => 352256/65536
[ApertureValue] => 565248/65536
[ExposureBiasValue] => 1/3
[MeteringMode] => 5
[Flash] => 16
[FocalLength] => 50/1
[UserComment] =>
[SubSecTime] => 03
[SubSecTimeOriginal] => 03
[SubSecTimeDigitized] => 03
[FlashPixVersion] => 0100
[ColorSpace] => 1
[ExifImageWidth] => 800
[ExifImageLength] => 533
[InteroperabilityOffset] => 956
[FocalPlaneXResolution] => 2256000/878
[FocalPlaneYResolution] => 1504000/584
[FocalPlaneResolutionUnit] => 2
[CustomRendered] => 0
[ExposureMode] => 0
[WhiteBalance] => 0
[SceneCaptureType] => 0
[InterOperabilityIndex] => R98
[InterOperabilityVersion] => 0100
)
잘 보았네요..
감사합니다. 완전 좋은 정보네요.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
15년 전 조회 1,427
15년 전 조회 1,694
15년 전 조회 1,052
15년 전 조회 976
15년 전 조회 1,133
15년 전 조회 1,199
15년 전 조회 1,010
15년 전 조회 1,286
15년 전 조회 1,365
15년 전 조회 1,287
15년 전 조회 3,195
15년 전 조회 876
15년 전 조회 1,436
15년 전 조회 1,026
15년 전 조회 1,832
15년 전 조회 800
15년 전 조회 959
15년 전 조회 947
15년 전 조회 972
15년 전 조회 1,706
15년 전 조회 3,013
15년 전 조회 2,090
15년 전 조회 2,000
15년 전 조회 991
15년 전 조회 1,097
15년 전 조회 1,042
15년 전 조회 915
15년 전 조회 1,207
15년 전 조회 928
15년 전 조회 1,362
15년 전 조회 811
15년 전 조회 719
15년 전 조회 1,607
15년 전 조회 858
15년 전 조회 1,312
15년 전 조회 1,176
15년 전 조회 849
15년 전 조회 872
15년 전 조회 781
15년 전 조회 754
15년 전 조회 920
15년 전 조회 1,179
15년 전 조회 2,354
15년 전 조회 940
15년 전 조회 1,030
15년 전 조회 1,067
15년 전 조회 1,054
15년 전 조회 1,142
15년 전 조회 746
15년 전 조회 2,008
15년 전 조회 850
15년 전 조회 1,659
15년 전 조회 805
15년 전 조회 809
15년 전 조회 1,489
15년 전 조회 1,092
15년 전 조회 1,381
15년 전 조회 1,697
15년 전 조회 1,336
15년 전 조회 1,428
15년 전 조회 798
15년 전 조회 2,347
15년 전 조회 1,076
15년 전 조회 809
15년 전 조회 1,149
15년 전 조회 864
15년 전 조회 2,120
15년 전 조회 1,157
15년 전 조회 952
15년 전 조회 1,061
15년 전 조회 1,017
15년 전 조회 1,046
15년 전 조회 1,108
15년 전 조회 620
15년 전 조회 544
15년 전 조회 512
15년 전 조회 1,214
15년 전 조회 1,011
15년 전 조회 841
15년 전 조회 844
15년 전 조회 1,240
15년 전 조회 3,263
15년 전 조회 1,132
15년 전 조회 1,936
15년 전 조회 1,187
15년 전 조회 1,020
15년 전 조회 2,672
15년 전 조회 1,673
15년 전 조회 2,559
15년 전 조회 2,683
15년 전 조회 1,392
15년 전 조회 1,102
15년 전 조회 1,568
15년 전 조회 974
15년 전 조회 1,262
15년 전 조회 1,165
15년 전 조회 1,558
15년 전 조회 1,713
15년 전 조회 952
15년 전 조회 1,388