douyue9704 2019-03-12 22:32
浏览 631
已采纳

使用PHP从HEIC照片中读取EXIF数据

I want to read the EXIF data from a HEIC photo.

If I run:

<?php 
    var_dump(exif_read_data("test.heic"));

I get

bool(false)

If I run the Linux tool exiftool test.heic - then I can see all the information that I need is there (location, camera name, etc).

If I run exif_read_data("test.jpg") - then I get data. So I know the syntax I'm using is correct.

I'm using PHP 7.1 and ImageMagick 6.9.4-10 (1684).

print_r(imagick::getVersion());
Array
(
    [versionNumber] => 1684
    [versionString] => ImageMagick 6.9.4-10 Q16 x86_64 2017-05-23 http://www.imagemagick.org
)

Do I need newer versions? If so, which ones work with HEIC?

  • 写回答

1条回答 默认 最新

  • dongtanxi5676756 2019-03-16 21:44
    关注

    This is a limitation in the EXIF extension for PHP. Currently the EXIF extension will only read two file formats:

    • JPEG
    • TIFF

    As the extension maintainer for EXIF in PHP, I cannot say that there is a specific plan to support more formats, as only recently one report has been posted at the bug tracker in regards to supporting PNG images (starting with version 1.5 of the PNG specification).

    My suggestion to you is to report it as a "Feature Request" on the PHP bug tracker so it can be tracked (and if you can provide details or even an experimental implementation, it would help push this into PHP faster). For now the only option is to convert images into JPEG or TIFF to make them readable by the EXIF extension.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!