代碼:
$file_arr = read_exif_data('./1.png');
var_dump($file_arr);
結果:
array (size=49)
'FileName' => string '2.png' (length=5)
'FileDateTime' => int 1446107171
'FileSize' => int 2640955
'FileType' => int 2
'MimeType' => string 'image/jpeg' (length=10)
'SectionsFound' => string 'ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP' (length=39)
'COMPUTED' =>
array (size=12)
'html' => string 'width="4128" height="2322"' (length=26)
'Height' => int 2322
'Width' => int 4128
'IsColor' => int 1
'ByteOrderMotorola' => int 0
'ApertureFNumber' => string 'f/2.2' (length=5)
'UserComment' => null
'UserCommentEncoding' => string 'ASCII' (length=5)
'Thumbnail.FileType' => int 2
'Thumbnail.MimeType' => string 'image/jpeg' (length=10)
'Thumbnail.Height' => int 288
'Thumbnail.Width' => int 512
'ImageWidth' => int 4128
'ImageLength' => int 2322
'Make' => string 'SAMSUNG' (length=7)
'Model' => string 'GT-I9500' (length=8)
'Orientation' => int 3
'XResolution' => string '72/1' (length=4)
'YResolution' => string '72/1' (length=4)
'ResolutionUnit' => int 2
'Software' => string 'I9500ZCUHND1' (length=12)
'DateTime' => string '2015:10:29 16:05:28' (length=19)
'YCbCrPositioning' => int 1
'Exif_IFD_Pointer' => int 226
'THUMBNAIL' =>
array (size=9)
'ImageWidth' => int 512
'ImageLength' => int 288
'Compression' => int 6
'Orientation' => int 3
'XResolution' => string '72/1' (length=4)
'YResolution' => string '72/1' (length=4)
'ResolutionUnit' => int 2
'JPEGInterchangeFormat' => int 10570
'JPEGInterchangeFormatLength' => int 11304
'ExposureTime' => string '1/33' (length=4)
'FNumber' => string '22/10' (length=5)
'ExposureProgram' => int 2
'ISOSpeedRatings' => int 160
'ExifVersion' => string '0220' (length=4)
'DateTimeOriginal' => string '2015:10:29 16:05:28' (length=19)
'DateTimeDigitized' => string '2015:10:29 16:05:28' (length=19)
'ShutterSpeedValue' => string '506/100' (length=7)
'ApertureValue' => string '227/100' (length=7)
'BrightnessValue' => string '177/100' (length=7)
'ExposureBiasValue' => string '0/10' (length=4)
'MaxApertureValue' => string '227/100' (length=7)
'MeteringMode' => int 2
參數說明:
'檔案名' => $infoAll['FileName'],
'檔案修改時間' => date('Y:m:d H:i:s',$infoAll['FileDateTime']),
'檔案大小' => round($infoAll['FileSize']/1024) . 'kb',
'Exif檔案類型' => $this->getImgtype($imgPath,'Exif'),
'Mime檔案類型' => $infoAll['MimeType'],
'找到Sections' => $infoAll['SectionsFound'],
'html中圖檔寬高' => $infoAll['html'],
'圖檔高度' => $infoAll['Height'] . 'px',
'圖檔寬度' => $infoAll['Width'] . 'px',
'是否彩色' => $infoAll['IsColor'] == 1 ? '是' : '否',
'是否為Motorola位元組順序' => $infoAll['ByteOrderMotorola'] == 1 ? '是' : '否',
'光圈數' => $infoAll['ApertureFNumber'],
'作者注釋' => $infoAll['Comments'],
'作者' => $infoAll['Author'],
'使用者注釋' => $infoAll['UserComment'],
'使用者注釋編碼' => $infoAll['UserCommentEncoding'],
'縮略圖Exif檔案類型' => $this->getImgtype($imgPath,'Exif'),
'縮略圖Mime檔案類型' => $infoAll['Thumbnail.MimeType'],
'制造商' => $infoAll['Make'],
'型号' => $infoAll['Model'],
'方向' => array_search($infoAll['Orientation'],array(
'top left side' => 1,
'top right side' => 2,
'bottom right side' => 3,
'bottom left side' => 4,
'left side top' => 5,
'right side top' => 6,
'right side bottom' => 7,
'left side bottom' => 8
)),
'水準分辨率' => $infoAll['XResolution'],
'垂直分辨率' => $infoAll['YResolution'],
'分辨率機關' => array_search($infoAll['ResolutionUnit'],array(
'無機關' => 1,
'英寸' => 2,
'厘米' => 3
)),
'建立軟體' => $infoAll['Software'],
'最後修改時間' => $infoAll['DateTime'],
'YCbCr位置控制' => $infoAll['YCbCrPositioning'] == 1 ? '像素陣列的中心' : '基準點',
'Exif圖像IFD的指針' => $infoAll['Exif_IFD_Pointer'],
'壓縮方式' => $infoAll['Compression'] == 6 ? 'jpeg壓縮' : '無壓縮',
'JPEG SOI偏移' => $infoAll['JPEGInterchangeFormat'],
'JPEG資料位元組' => $infoAll['JPEGInterchangeFormatLength'],
'曝光時間' => $infoAll['ExposureTime'] . '秒',
'焦距比數' => $infoAll['FNumber'],
'曝光程式' => array_search($infoAll['ExposureProgram'],array(
'手動控制' => 1,
'程式控制' => 2,
'光圈優先' => 3,
'快門優先' => 4,
'景深優先' => 5,
'運動模式' => 6,
'肖像模式' => 7,
'風景模式' => 8
)),
'ISO感光度' => $infoAll['ISOSpeedRatings'],
'Exif版本' => $infoAll['ExifVersion'],
'拍攝時間' => $infoAll['DateTimeOriginal'],
'數字化時間' => $infoAll['DateTimeDigitized'],
'分量配置' => $infoAll['ComponentsConfiguration'],
'圖像壓縮率' => $infoAll['CompressedBitsPerPixel'],
'曝光補償' => $infoAll['ExposureBiasValue'] . '電子伏特',
'最大光圈值' => $infoAll['MaxApertureValue'],
'測光模式' => array_search($infoAll['MeteringMode'],array(
'未知' => 0,
'平均' => 1,
'中央重點平均測光' => 2,
'點測' => 3,
'分區' => 4,
'評估' => 5,
'局部' => 6,
'其他' => 255
)),
'光源' => array_search($infoAll['LightSource'],array(
'未知' => 0,
'日光燈' => 1,
'熒光燈' => 2,
'鎢絲燈' => 3,
'閃光燈' => 10,
'标準燈光A' => 17,
'标準燈光B' => 18,
'标準燈光C' => 19,
'D55' => 20,
'D65' => 21,
'D75' => 22,
'其他' => 255,
)),
'閃光燈' => array_search($infoAll['Flash'],array(
'閃光燈未閃光' => 0,
'閃光燈已閃光' => 1,
'閃光燈已閃光但頻閃觀測器未檢測到傳回光源' => 5,
'閃光燈已閃光,頻閃觀測器檢測到傳回光源' => 7
)),
'焦距' => $infoAll['FocalLength'] . '毫米',
'亞秒時間' => $infoAll['SubSecTime'],
'亞秒級拍攝時間' => $infoAll['SubSecTimeOriginal'],
'亞秒級數字化時間' => $infoAll['SubSecTimeDigitized'],
'FlashPix版本' => $infoAll['FlashPixVersion'],
'色彩空間' => $infoAll['ColorSpace'] == 1 ? 'sRGB' : 'Uncalibrated',
'Exif圖檔寬度' => $infoAll['ExifImageWidth'] . 'px',
'EXif圖檔高度' => $infoAll['ExifImageLength'] . 'px',
'IFD格式資料偏移量' => $infoAll['InteroperabilityOffset'],
'彩色區域傳感器類型' => $infoAll['SensingMethod'] == 2 ? '單色區傳感器' : '其他',
'圖檔像源' => $infoAll['FileSource'] == '0x03' ? '數位相機' : '其他',
'場景類型' => $infoAll['SceneType'] == '0x01' ? '直接拍攝' : '其他',
'濾波陣列圖案' => $infoAll['CFAPattern'],
'自定義圖像處理' => $infoAll['CustomRendered'],
'曝光模式' => $infoAll['CustomRendered'] == 1 ? '手動' : '自動',
'白平衡' => $infoAll['WhiteBalance'] == 1 ? '手動' : '自動',
'數位變焦倍率' => $infoAll['DigitalZoomRatio'],
'等價35mm焦距' => $infoAll['FocalLengthIn35mmFilm'] . '毫米',
'取景模式' => array_search($infoAll['SceneCaptureType'],array(
'自動' => 0,
'肖像場景' => 1,
'景觀場景' => 2,
'運動場景' => 3,
'夜景' => 4,
'自動曝光' => 5,
'光圈優先自動曝光' => 256,
'快門優先自動曝光' => 512,
'手動曝光' => 768,
)),
'增益控制' => $infoAll['GainControl'],
'對比度' => array_search($infoAll['Contrast'],array(
'低' => -1,
'普通' => 0,
'高' => 1
)),
'飽和度' => array_search($infoAll['Saturation'],array(
'低' => -1,
'普通' => 0,
'高' => 1
)),
'清晰度' => array_search($infoAll['Sharpness'],array(
'低' => -1,
'普通' => 0,
'高' => 1
)),
'對焦距離' => array_search($infoAll['SubjectDistanceRange'],array(
'未知' => 0,
'微距' => 1,
'近景' => 2,
'遠景' => 3
)),
'InterOperability指數' => $infoAll['InterOperabilityIndex'],
'InterOperability版本' => $infoAll['InterOperabilityVersion']