리자

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

· 2010-09-30 (목) 22:03:51 · 3429 · 5
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
)
2010-10-01 (금) 23:49:40
잘 보았네요..
감사합니다. 완전 좋은 정보네요.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
11-10-25 조회 2,312
11-10-18 조회 3,837
11-10-18 조회 2,286
11-10-15 조회 3,510
11-10-10 조회 2,572
11-10-02 조회 2,490
11-09-28 조회 2,319
11-09-24 조회 2,392
11-09-22 조회 2,271
11-09-05 조회 2,809
11-08-31 조회 2,150
11-08-31 조회 2,398
11-08-31 조회 2,307
11-08-29 조회 2,877
11-08-28 조회 2,358
11-08-25 조회 2,423
11-08-17 조회 2,100
11-08-16 조회 2,364
11-08-11 조회 2,794
11-08-07 조회 2,490
11-08-03 조회 2,256
11-07-22 조회 2,012
11-07-12 조회 3,217
11-06-27 조회 1,936
11-06-01 조회 1,697
11-05-17 조회 2,393
11-05-01 조회 2,547
11-04-28 조회 2,745
11-04-28 조회 2,887
11-04-13 조회 2,513
11-03-27 조회 2,661
11-03-27 조회 2,549
11-03-14 조회 1,964
11-03-02 조회 2,269
11-03-02 조회 2,505
11-02-27 조회 2,927
11-02-23 조회 2,327
11-02-19 조회 2,478
11-02-14 조회 4,063
11-02-03 조회 2,888
11-01-24 조회 3,820
11-01-04 조회 2,352
10-12-08 조회 5,319
10-11-15 조회 2,325
10-11-14 조회 2,504
10-11-14 조회 3,438
10-10-29 조회 3,608
10-10-19 조회 2,633
10-10-07 조회 2,466
10-10-05 조회 4,370
10-09-18 조회 2,654
10-09-18 조회 2,418
10-09-17 조회 4,794
10-09-15 조회 2,761
10-09-15 조회 2,290
10-09-15 조회 2,730
10-09-15 조회 2,588
10-09-11 조회 3,925
10-09-11 조회 2,435
10-09-11 조회 2,471
10-09-07 조회 3,744
10-09-07 조회 3,283
10-08-29 조회 2,742
10-07-01 조회 2,992
10-06-30 조회 2,378
10-06-30 조회 2,574
10-06-30 조회 2,931
10-06-13 조회 1,950
10-04-15 조회 3,139
10-04-04 조회 3,358
10-02-23 조회 3,426
10-02-09 조회 3,034
10-01-25 조회 2,571
10-01-25 조회 2,668
09-12-27 조회 4,314
09-11-23 조회 3,533
09-11-20 조회 4,777
09-08-30 조회 2,974
09-08-30 조회 2,979
09-08-12 조회 2,917
09-07-22 조회 3,984
09-07-22 조회 4,485
09-07-15 조회 5,824
09-07-11 조회 2,861
09-06-17 조회 2,645
09-06-15 조회 2,913
09-05-29 조회 3,200
09-05-11 조회 5,847
09-05-08 조회 2,597
09-04-30 조회 3,707
09-04-17 조회 3,028
09-04-04 조회 3,196
09-03-05 조회 3,590
09-02-09 조회 3,376
09-02-03 조회 6,029
08-12-27 조회 3,108
08-12-20 조회 4,246
08-11-21 조회 5,205
08-11-14 조회 2,746
08-11-03 조회 3,220