| How do I write image exif data?
|
ocon

msg:4494396 | 5:15 pm on Sep 12, 2012 (gmt 0) | I am using PHP Version 5.3.14 compiled with ImageMagick 6.7.6-3. I would eventually like to geotag the thumbnails my script creates using the correct exif data, but right now I am having a very difficult time just writing any exif data.
// The following is directly from PHP's website $image = new Imagick(); $image->newImage(300, 200, "black"); $image->setImageProperty('Exif:Make', 'Imagick'); echo $image->getImageProperty('Exif:Make'); // The page does display "Imagick"
// Now I'm writing the image I just created to my hard drive and freeing my memory. $image->writeImage("test.jpg"); $image->destroy();
// Now I'm displaying the exif data of the saved image $exif = exif_read_data("test.jpg", 0, true); print_r($exif); All that is showing is:
Imagick
Array ( [FILE] => Array ( [FileName] => test.jpg [FileDateTime] => 1347469943 [FileSize] => 398 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => )
[COMPUTED] => Array ( [html] => width="300" height="200" [Height] => 200 [Width] => 300 [IsColor] => 0 )
)
What am I doing wrong? How can I properly add exif data to my images?
|
jadebox

msg:4494901 | 9:38 pm on Sep 13, 2012 (gmt 0) | In spite of the examples in the documentation, I don't think that ImageMagik really writes EXIF data to the image. In your example, it's just saving a loading a property with "Exif" in the name, but not actually saving it in EXIF format. Look at the PHP EXI Library (PEL): [lsolesen.github.com...] PEL supports reading and writing of EXIF data. -- Roger
|
|
|