有几天我试图使用
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
非常感谢你提前!
博主尝试使用PHP的Imagick库来更新JPG图像的EXIF地理标记(经度和纬度),但保存图片后EXIF信息未被保存。代码包括加载图像、剥离现有EXIF信息、设置新属性以及写入图像。尽管设置成功,但写入的图像并未包含更新的EXIF数据。寻求解决方案。
610

被折叠的 条评论
为什么被折叠?



