리자

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

· 2010-09-30 (목) 22:03:51 · 3438 · 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건
+
제목 글쓴이 날짜 조회
12-08-29 조회 3,867
12-08-07 조회 3,540
12-08-03 조회 3,486
12-07-31 조회 3,599
12-07-30 조회 3,560
12-07-16 조회 3,753
12-07-15 조회 3,454
12-07-07 조회 3,438
12-07-06 조회 3,537
12-07-03 조회 3,611
12-06-29 조회 3,209
12-06-22 조회 3,574
12-06-17 조회 3,666
12-05-21 조회 3,746
12-05-02 조회 3,334
12-05-02 조회 4,133
12-05-02 조회 3,252
12-04-30 조회 3,359
12-04-30 조회 3,074
12-03-17 조회 3,881
12-03-10 조회 3,321
12-03-08 조회 3,725
12-03-03 조회 3,503
12-02-27 조회 4,906
12-02-17 조회 4,240
12-02-16 조회 4,394
12-02-03 조회 3,253
12-01-31 조회 2,974
12-01-24 조회 3,060
12-01-17 조회 3,809
12-01-05 조회 3,371
11-12-30 조회 2,983
11-12-23 조회 4,565
11-12-08 조회 3,288
11-12-07 조회 4,316
11-11-27 조회 3,755
11-11-25 조회 4,008
11-11-23 조회 3,424
11-11-22 조회 3,386
11-11-09 조회 3,167
11-10-23 조회 3,055
11-10-19 조회 3,040
11-10-08 조회 2,742
11-10-04 조회 2,767
11-10-04 조회 5,207
11-09-01 조회 4,259
11-08-13 조회 2,432
11-08-06 조회 3,120
11-07-11 조회 3,492
11-06-27 조회 2,893
11-06-21 조회 2,504
11-06-13 조회 2,339
11-06-07 조회 2,321
11-05-26 조회 2,331
11-04-20 조회 2,668
11-03-21 조회 2,757
11-03-18 조회 2,447
11-03-11 조회 2,468
11-02-07 조회 2,302
11-01-18 조회 2,633
11-01-12 조회 2,313
11-01-06 조회 2,467
10-12-10 조회 2,726
10-12-09 조회 2,370
10-12-08 조회 4,969
10-11-29 조회 2,463
10-11-28 조회 2,705
10-11-28 조회 2,532
10-11-19 조회 2,724
10-11-04 조회 2,657
10-10-21 조회 2,376
10-10-19 조회 3,327
10-10-12 조회 2,647
10-10-07 조회 2,425
10-09-30 조회 3,439
10-09-17 조회 3,831
10-09-17 조회 3,797
10-05-31 조회 3,454
09-12-31 조회 3,601
09-07-23 조회 4,894
08-09-16 조회 3,160
08-09-06 조회 2,883
08-09-04 조회 3,274
08-08-16 조회 4,355
08-08-15 조회 3,238
08-08-14 조회 4,452
08-08-12 조회 3,805
08-07-23 조회 2,739
08-07-10 조회 3,671
08-07-04 조회 2,901
08-06-27 조회 7,558
08-06-19 조회 4,842
08-05-27 조회 5,457
08-05-25 조회 5,282
08-05-23 조회 3,357
08-05-23 조회 4,454
08-05-21 조회 4,838
08-05-20 조회 3,999
08-05-20 조회 3,240
08-04-18 조회 4,226