使用PHP将EXIF写入JPG

使用PHP将EXIF写入JPG,php,exif,imagick,Php,Exif,Imagick,几天来,我一直在尝试使用PHP在JPG图像中写入(或更新)EXIF信息(地理标签、纬度和经度)。 在咨询了许多网站但没有成功后,我认为最好的选择是使用Imagick,但尽管我似乎可以使用setImageProperty()设置纬度和经度,但当我写图片时,EXIF不会保存 这里我给出一个代码片段: //Loading existing image $edited = new Imagick(dirname(__FILE__)."/mini.jpg"); //Stripping the curren

几天来,我一直在尝试使用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


提前非常感谢

我找到的唯一方法是安装gd或ImageMagick库将帮助您完成这类工作。
如果您使用的是共享主机,则可能已经为您安装了一个(或两个)。

可能是@Brad的副本谢谢您的链接!谢谢,但似乎gb ad ImageMagick无法编写EXIF tagsTerecen Eden,我一直在测试PEL似乎工作正常。非常感谢。