리자

[펌] 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,657
15년 전 조회 1,913
15년 전 조회 1,294
15년 전 조회 1,201
15년 전 조회 1,369
15년 전 조회 1,427
15년 전 조회 1,222
15년 전 조회 1,509
15년 전 조회 1,610
15년 전 조회 1,512
15년 전 조회 3,441
15년 전 조회 1,092
15년 전 조회 1,671
15년 전 조회 1,249
15년 전 조회 2,054
15년 전 조회 1,034
15년 전 조회 1,169
15년 전 조회 1,172
15년 전 조회 1,199
15년 전 조회 1,918
15년 전 조회 3,253
15년 전 조회 2,318
15년 전 조회 2,217
15년 전 조회 1,202
15년 전 조회 1,319
15년 전 조회 1,257
15년 전 조회 1,142
15년 전 조회 1,432
15년 전 조회 1,135
15년 전 조회 1,587
15년 전 조회 1,018
15년 전 조회 928
15년 전 조회 1,816
15년 전 조회 1,074
15년 전 조회 1,522
15년 전 조회 1,389
15년 전 조회 1,057
15년 전 조회 1,082
15년 전 조회 989
15년 전 조회 969
15년 전 조회 1,142
15년 전 조회 1,389
15년 전 조회 2,564
15년 전 조회 1,148
15년 전 조회 1,252
15년 전 조회 1,282
15년 전 조회 1,281
15년 전 조회 1,345
15년 전 조회 963
15년 전 조회 2,222
15년 전 조회 1,074
15년 전 조회 1,881
15년 전 조회 1,006
15년 전 조회 1,033
15년 전 조회 1,698
15년 전 조회 1,296
15년 전 조회 1,613
15년 전 조회 1,923
15년 전 조회 1,541
15년 전 조회 1,643
15년 전 조회 1,019
15년 전 조회 2,548
15년 전 조회 1,291
15년 전 조회 1,010
15년 전 조회 1,372
15년 전 조회 1,081
15년 전 조회 2,345
15년 전 조회 1,384
15년 전 조회 1,179
15년 전 조회 1,279
15년 전 조회 1,253
15년 전 조회 1,270
15년 전 조회 1,334
15년 전 조회 834
15년 전 조회 777
15년 전 조회 754
15년 전 조회 1,433
15년 전 조회 1,237
15년 전 조회 1,072
15년 전 조회 1,066
15년 전 조회 1,461
15년 전 조회 3,499
15년 전 조회 1,370
15년 전 조회 2,165
15년 전 조회 1,421
15년 전 조회 1,252
15년 전 조회 2,922
15년 전 조회 1,896
15년 전 조회 2,796
15년 전 조회 2,900
15년 전 조회 1,640
15년 전 조회 1,337
15년 전 조회 1,832
15년 전 조회 1,252
15년 전 조회 1,555
15년 전 조회 1,429
15년 전 조회 1,830
15년 전 조회 1,999
15년 전 조회 1,247
15년 전 조회 1,678