exif_read_data PHP 7.2 没有 return 所有元数据
exif_read_data on PHP 7.2 doesn't return all metadata
关于PHP7.2,内置函数exif_read_data
returns与PHP7.1
不同的信息
这是我使用 7.2 时得到的结果:
php -r 'var_export(exif_read_data("x.jpg", "ANY_TAG"));'
array (
'FileName' => 'x.jpg',
'FileDateTime' => 1543144462,
'FileSize' => 3564506,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0, EXIF',
'COMPUTED' =>
array (
'html' => 'width="3968" height="2976"',
'Height' => 2976,
'Width' => 3968,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
),
'ImageWidth' => 3968,
'ImageLength' => 2976,
'BitsPerSample' =>
array (
0 => 8,
1 => 8,
2 => 8,
),
'ImageDescription' => 'ptr',
'Make' => 'HUAWEI',
'Model' => 'STF-L09',
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'Software' => 'STF-L09C432B120',
'DateTime' => '2018:11:24 15:11:58',
'YCbCrPositioning' => 1,
)
但是当我 运行 在 7.1 上使用完全相同的代码时,我得到了更多的 EXIF 数据:
array (
'FileName' => 'x.jpg',
'FileDateTime' => 1543144462,
'FileSize' => 3564506,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP',
'COMPUTED' =>
array (
'html' => 'width="3968" height="2976"',
'Height' => 2976,
'Width' => 3968,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
'ApertureFNumber' => 'f/2.2',
'Thumbnail.FileType' => 2,
'Thumbnail.MimeType' => 'image/jpeg',
'Thumbnail.Height' => 384,
'Thumbnail.Width' => 512,
),
'ImageWidth' => 3968,
'ImageLength' => 2976,
'BitsPerSample' =>
array (
0 => 8,
1 => 8,
2 => 8,
),
'ImageDescription' => 'ptr',
'Make' => 'HUAWEI',
'Model' => 'STF-L09',
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'Software' => 'STF-L09C432B120',
'DateTime' => '2018:11:24 15:11:58',
'YCbCrPositioning' => 1,
'Exif_IFD_Pointer' => 280,
'GPS_IFD_Pointer' => 8454,
'DeviceSettingDescription' => 'ipp' . "[=14=]" . '',
'THUMBNAIL' =>
array (
'ImageWidth' => 512,
'ImageLength' => 384,
'Compression' => 6,
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'JPEGInterchangeFormat' => 8802,
'JPEGInterchangeFormatLength' => 31647,
),
'DocumentName' => NULL,
'ExposureTime' => '30000000/1000000000',
'FNumber' => '220/100',
'ExposureProgram' => 2,
'ISOSpeedRatings' => 320,
'ExifVersion' => '0210',
'DateTimeOriginal' => '2018:11:24 15:11:58',
'DateTimeDigitized' => '2018:11:24 15:11:58',
'ComponentsConfiguration' => '' . "[=14=]" . '',
'ShutterSpeedValue' => '298973/10000',
'ApertureValue' => '227/100',
'BrightnessValue' => '0/1',
'ExposureBiasValue' => '0/10',
'MeteringMode' => 5,
'LightSource' => 1,
'Flash' => 0,
'FocalLength' => '3950/1000',
'MakerNote' => 'Auto',
'SubSecTime' => '405238',
'SubSecTimeOriginal' => '405238',
'SubSecTimeDigitized' => '405238',
'FlashPixVersion' => '0100',
'ColorSpace' => 1,
'ExifImageWidth' => 3968,
'ExifImageLength' => 2976,
'InteroperabilityOffset' => 8424,
'SensingMethod' => 2,
'FileSource' => '',
'SceneType' => '',
'CustomRendered' => 1,
'ExposureMode' => 0,
'WhiteBalance' => 0,
'DigitalZoomRatio' => '100/100',
'FocalLengthIn35mmFilm' => 27,
'SceneCaptureType' => 0,
'GainControl' => 0,
'Contrast' => 0,
'Saturation' => 0,
'Sharpness' => 0,
'SubjectDistanceRange' => 0,
'GPSVersion' => '' . "[=14=]" . '' . "[=14=]" . '',
'GPSLatitudeRef' => 'N',
'GPSLatitude' =>
array (
0 => '51/1',
1 => '8/1',
2 => '49994201/1000000',
),
'GPSLongitudeRef' => 'W',
'GPSLongitude' =>
array (
0 => '2/1',
1 => '42/1',
2 => '59101467/1000000',
),
'GPSAltitudeRef' => '' . "[=14=]" . '',
'GPSAltitude' => '7162/100',
'GPSTimeStamp' =>
array (
0 => '15/1',
1 => '11/1',
2 => '58/1',
),
'GPSProcessingMode' => 'GPS' . "[=14=]" . '',
'GPSDateStamp' => '2018:11:24',
'InterOperabilityIndex' => 'R98',
'InterOperabilityVersion' => '0100',
)
在使用 7.2 时,是否可以进行任何模块、扩展或更改以获取完整的 EXIF 数据?我在一个共享的 Linux 主机上,所以我能做的事情有一些限制。
这似乎是 PHP - https://bugs.php.net/bug.php?id=72682 and https://abi-laboratory.pro/index.php?view=changelog&l=php&v=7.2.3
中的错误
唯一的答案是降级或升级到没有错误的版本。
关于PHP7.2,内置函数exif_read_data
returns与PHP7.1
这是我使用 7.2 时得到的结果:
php -r 'var_export(exif_read_data("x.jpg", "ANY_TAG"));'
array (
'FileName' => 'x.jpg',
'FileDateTime' => 1543144462,
'FileSize' => 3564506,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0, EXIF',
'COMPUTED' =>
array (
'html' => 'width="3968" height="2976"',
'Height' => 2976,
'Width' => 3968,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
),
'ImageWidth' => 3968,
'ImageLength' => 2976,
'BitsPerSample' =>
array (
0 => 8,
1 => 8,
2 => 8,
),
'ImageDescription' => 'ptr',
'Make' => 'HUAWEI',
'Model' => 'STF-L09',
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'Software' => 'STF-L09C432B120',
'DateTime' => '2018:11:24 15:11:58',
'YCbCrPositioning' => 1,
)
但是当我 运行 在 7.1 上使用完全相同的代码时,我得到了更多的 EXIF 数据:
array (
'FileName' => 'x.jpg',
'FileDateTime' => 1543144462,
'FileSize' => 3564506,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP',
'COMPUTED' =>
array (
'html' => 'width="3968" height="2976"',
'Height' => 2976,
'Width' => 3968,
'IsColor' => 1,
'ByteOrderMotorola' => 1,
'ApertureFNumber' => 'f/2.2',
'Thumbnail.FileType' => 2,
'Thumbnail.MimeType' => 'image/jpeg',
'Thumbnail.Height' => 384,
'Thumbnail.Width' => 512,
),
'ImageWidth' => 3968,
'ImageLength' => 2976,
'BitsPerSample' =>
array (
0 => 8,
1 => 8,
2 => 8,
),
'ImageDescription' => 'ptr',
'Make' => 'HUAWEI',
'Model' => 'STF-L09',
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'Software' => 'STF-L09C432B120',
'DateTime' => '2018:11:24 15:11:58',
'YCbCrPositioning' => 1,
'Exif_IFD_Pointer' => 280,
'GPS_IFD_Pointer' => 8454,
'DeviceSettingDescription' => 'ipp' . "[=14=]" . '',
'THUMBNAIL' =>
array (
'ImageWidth' => 512,
'ImageLength' => 384,
'Compression' => 6,
'Orientation' => 0,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'JPEGInterchangeFormat' => 8802,
'JPEGInterchangeFormatLength' => 31647,
),
'DocumentName' => NULL,
'ExposureTime' => '30000000/1000000000',
'FNumber' => '220/100',
'ExposureProgram' => 2,
'ISOSpeedRatings' => 320,
'ExifVersion' => '0210',
'DateTimeOriginal' => '2018:11:24 15:11:58',
'DateTimeDigitized' => '2018:11:24 15:11:58',
'ComponentsConfiguration' => '' . "[=14=]" . '',
'ShutterSpeedValue' => '298973/10000',
'ApertureValue' => '227/100',
'BrightnessValue' => '0/1',
'ExposureBiasValue' => '0/10',
'MeteringMode' => 5,
'LightSource' => 1,
'Flash' => 0,
'FocalLength' => '3950/1000',
'MakerNote' => 'Auto',
'SubSecTime' => '405238',
'SubSecTimeOriginal' => '405238',
'SubSecTimeDigitized' => '405238',
'FlashPixVersion' => '0100',
'ColorSpace' => 1,
'ExifImageWidth' => 3968,
'ExifImageLength' => 2976,
'InteroperabilityOffset' => 8424,
'SensingMethod' => 2,
'FileSource' => '',
'SceneType' => '',
'CustomRendered' => 1,
'ExposureMode' => 0,
'WhiteBalance' => 0,
'DigitalZoomRatio' => '100/100',
'FocalLengthIn35mmFilm' => 27,
'SceneCaptureType' => 0,
'GainControl' => 0,
'Contrast' => 0,
'Saturation' => 0,
'Sharpness' => 0,
'SubjectDistanceRange' => 0,
'GPSVersion' => '' . "[=14=]" . '' . "[=14=]" . '',
'GPSLatitudeRef' => 'N',
'GPSLatitude' =>
array (
0 => '51/1',
1 => '8/1',
2 => '49994201/1000000',
),
'GPSLongitudeRef' => 'W',
'GPSLongitude' =>
array (
0 => '2/1',
1 => '42/1',
2 => '59101467/1000000',
),
'GPSAltitudeRef' => '' . "[=14=]" . '',
'GPSAltitude' => '7162/100',
'GPSTimeStamp' =>
array (
0 => '15/1',
1 => '11/1',
2 => '58/1',
),
'GPSProcessingMode' => 'GPS' . "[=14=]" . '',
'GPSDateStamp' => '2018:11:24',
'InterOperabilityIndex' => 'R98',
'InterOperabilityVersion' => '0100',
)
在使用 7.2 时,是否可以进行任何模块、扩展或更改以获取完整的 EXIF 数据?我在一个共享的 Linux 主机上,所以我能做的事情有一些限制。
这似乎是 PHP - https://bugs.php.net/bug.php?id=72682 and https://abi-laboratory.pro/index.php?view=changelog&l=php&v=7.2.3
中的错误唯一的答案是降级或升级到没有错误的版本。