Tips & Tricks |
|
2024-11-24 |
|
|
7 |
|
|
Reading EXIF Headers from a JPEG
<?php
$data = exif_read_data('presentations/slides/intro/img_resize.jpg');
foreach($data as $key=>$val) {
if(is_array($val)) {
foreach($val as $k=>$v) {
echo $key."[$k]: $v<br />\n";
}
} else
echo "$key: ".@substr($val,0,40)."<br />\n";
}
?>
Output
FileName: img_resize.jpg
FileDateTime: 1707321300
FileSize: 669158
FileType: 2
MimeType: image/jpeg
SectionsFound: ANY_TAG, IFD0, THUMBNAIL, EXIF
COMPUTED[html]: width="1536" height="1024"
COMPUTED[Height]: 1024
COMPUTED[Width]: 1536
COMPUTED[IsColor]: 1
COMPUTED[ByteOrderMotorola]: 0
COMPUTED[ApertureFNumber]: f/4.0
COMPUTED[FocusDistance]: 1.07m
COMPUTED[Thumbnail.FileType]: 8
COMPUTED[Thumbnail.MimeType]: image/tiff
COMPUTED[Thumbnail.Height]: 64
COMPUTED[Thumbnail.Width]: 96
Make: Eastman Kodak Company
Model: KODAK DC265 ZOOM DIGITAL CAMERA (V01.00)
Orientation: 1
XResolution: 150/1
YResolution: 150/1
ResolutionUnit: 2
YCbCrPositioning: 1
Exif_IFD_Pointer: 190
THUMBNAIL[ImageWidth]: 96
THUMBNAIL[ImageLength]: 64
THUMBNAIL[BitsPerSample]: Array
THUMBNAIL[Compression]: 1
THUMBNAIL[PhotometricInterpretation]: 2
THUMBNAIL[StripOffsets]: 1748
THUMBNAIL[Orientation]: 1
THUMBNAIL[SamplesPerPixel]: 3
THUMBNAIL[RowsPerStrip]: 64
THUMBNAIL[StripByteCounts]: 18432
THUMBNAIL[XResolution]: 72/1
THUMBNAIL[YResolution]: 72/1
THUMBNAIL[PlanarConfiguration]: 1
THUMBNAIL[ResolutionUnit]: 2
ExposureTime: 1/250
FNumber: 400/100
ExifVersion: 0200
DateTimeOriginal: 1999:01:31 04:17:59
ComponentsConfiguration:
CompressedBitsPerPixel: 24/10
ShutterSpeedValue: 800/100
ApertureValue: 400/100
ExposureBiasValue: 0/100
MaxApertureValue: 300/100
SubjectDistance: 107/100
MeteringMode: 2
LightSource: 0
Flash: 1
FocalLength: 80000/10000
MakerNote:
FlashPixVersion: 0100
ColorSpace: 1
ExifImageWidth: 1536
ExifImageLength: 1024
Fetching an embedded thumbnail
<?
Header('Content-type: image/tiff');
echo exif_thumbnail('p0004557.jpg');
?>