微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用PHP将EXIF写入JPG

有几天我试图使用 PHP在JPG图像中编写(或更新)EXIF信息(地理标记,经度和纬度).
在咨询了许多网站但没有成功之后,我认为最好的选择是使用Imagick但是虽然看起来我可以用setimageproperty()设置纬度和经度,但是当我写图片时,EXIF没有被保存.

在这里我给出一个代码片段:

//Loading existing image
$edited = new Imagick(dirname(__FILE__)."/mini.jpg");
//Stripping the curren EXIF info. I think is not mandatory and I try to comment but nothing...
$edited->stripImage();
//Setting the new properties
$edited->setimageProperty('exif:GPSLatitude','30/1,46/1,58605/1000');
$edited->setimageProperty('exif:GPSLongitude','63/1,57/1,35550/1000');
$propiedades = $edited->getimageProperties();
var_dump($propiedades);
var_dump($edited->writeImage('mini_edited.jpg'));


//reading the new image EXIF Info
$readedited = new Imagick(dirname(__FILE__)."/mini_edited.jpg");
$propiedades_edited = $readedited->getimageProperties();

图像已成功保存,但没有exif信息更新.

任何人都知道如何用这个或任何其他工具解决这个问题?
唯一的要求是使用PHP

非常感谢你提前!

解决方法

我找到的唯一方法是安装 PEL – the PHP Exif Library

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐