1

My goal is simple: I'd like to modify the 'Comments' field on an image. This is easy to do manually on any file on Windows (just right click and type in whatever you want).

To do so via PHP does not seem clear at all. There are several drivers out there. I have tried them all and simply could not get them to work. Does anyone have direct experience with one and can provide a concrete example how to do this?

The only thing I got that sort of worked was this http://blog.jacobemerick.com/web-development/manipulating-jpeg-exif-headers/.

However, although I can update some fields it also deletes everything else. I have no experience with EXIF before and from what I can tell he is decodeing the raw image data and interpreting the sections. I simply do not have the knowledge to modify his code for my purposes.

I've tried https://github.com/romainneutron/PHPExiftool but I simply get errors about different classes not being available. I guess this is expected as it's clearly still in development.

I would appreciate any guidance as I'm pretty sure I've read everything the internet has to offer on the topic.

4

1 Answer 1

1

The easiest way is to just use exiftool via imagemagick. This is technically command line, not PHP, though you can use exec (bad) or lean on some of PHP's imagemagick extension. The post you linked to was something I wrote a few years ago and has a few limitations... Only working for certain encoding (Canon, can't remember the specifics) and yes, it does strip out everything and then rebuild. Easier than surgical replacements ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.