Write EXIF into JPG with PHP

For a couple of days I'm trying to write (or update) EXIF information (geotag, latitude and longitude) in a JPG image using PHP. After consulting many sites without success I think the best option is to use Imagick but although it seems I can set the latitude and longitude with setImageProperty(), but when I write the picture the EXIF is not saved.

Here I give a code fragment:

//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();

The image is saved successfully but no the exif information updates.

Anyone have an idea how I can solve this problem with this or any other tool? The only requirement is to use PHP

Thank you very much in advance!

Answers


The only way I've found is to install PEL - the PHP Exif Library


Need Your Help

Swagger same path specified twice

swagger swagger-ui

Is it possible to have same path appear more than once in one API spec which is being rendered by Swagger-UI?

Javascript Error: Permission denied to access property 'resizeTo'

javascript

I am using Firebug's console to learn Javascript and when i poped up a window like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.