幾天後,我嘗試使用PHP在JPG圖像中編寫(或更新)EXIF信息(地理標記,經度和緯度)。 經過諮詢很多網站沒有成功,我認爲最好的選擇是使用Imagick,但雖然看起來我可以用setImageProperty()設置經緯度,但是當我寫入圖片時,EXIF未保存。使用PHP將EXIF寫入JPG
這裏,我給一個代碼片段:
//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
非常感謝您提前!
可能重複的[如何將exif數據添加到圖像?](http://stackoverflow.com/questions/229446/how-do-i-add-exif-data-to-an-image) – Brad 2012-04-03 21:21:40
@布拉德感謝您的鏈接! – CesarTrigo 2014-11-15 16:47:44