几天来,我尝试使用 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 - PHP Exif 库
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)