exif_read_data в PHP 7.2 не возвращает все метаданные - PullRequest
0 голосов
/ 25 ноября 2018

В PHP 7.2 встроенная функция exif_read_data возвращает различную информацию в PHP 7.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' . "\0" . '',
  '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' => '' . "\0" . '',
  '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' => '' . "\0" . '' . "\0" . '',
  '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' => '' . "\0" . '',
  'GPSAltitude' => '7162/100',
  'GPSTimeStamp' => 
  array (
    0 => '15/1',
    1 => '11/1',
    2 => '58/1',
  ),
  'GPSProcessingMode' => 'GPS' . "\0" . '',
  'GPSDateStamp' => '2018:11:24',
  'InterOperabilityIndex' => 'R98',
  'InterOperabilityVersion' => '0100',
)

Существуют ли какие-либо модули, расширения или изменения, которые я могу сделать, чтобы получить полные данные EXIFпри использовании 7.2?Я на общем хосте Linux, поэтому у меня есть некоторые ограничения на то, что я могу сделать.

1 Ответ

0 голосов
/ 26 ноября 2018

Это похоже на ошибку в PHP - https://bugs.php.net/bug.php?id=72682 и https://abi -laboratory.pro / index.php? View = changelog & l = php & v = 7.2.3

Единственный ответ - понизить или обновить до версии, в которой нет ошибки.

...