symphonycms / jit_image_manipulation

Just in Time Image Manipulation for Symphony CMS
http://symphonyextensions.com/extensions/jit_image_manipulation/
Other
25 stars 42 forks source link

Preserve Metadata #154

Open animaux opened 7 years ago

animaux commented 7 years ago

GD does not retain any EXIF/XMP- or other Metadata while creating scaled images.

This may seem unimportant, but there are plenty of usecases where at least a copyright entry would be important to have, since it’s obviously easy to download the images JIT creates. Even Facebook is facing legal action here:

https://petapixel.com/2016/11/22/german-photographer-sued-facebook-removing-exif-data-won/

Here’s some info and actual code supposed to work with GD: http://metadatamanifesto.blogspot.de/2008/05/free-php-scripts-preserve-metadata-for.html

This link is quite old though.

Sorry, the link on the above page is not leading to this info anymore.

michael-e commented 7 years ago

I am currently doing some research on that matter. It seems that GD is not the right tool if you want to preserve EXIF data. Imagick is more powerful, but unfortunately it may not be available on cheap hosting environments. So I don't see a solution that could be built into JIT.

It would be interesting to create something like a "JIT Pro" extension for Symphony which uses Imagick exclusively. But I won't find the time to do this. Instead I will implement some ugly hacks in JIT, probably.

There are three interesting issues nowadays with JIT and images:

animaux commented 7 years ago

At least with providers I normally use Imagick is supported. JIT 2 is generally quite a hack currently. With @nitriques as a fresh parent I don’t see the current issues getting fixed soon.

http://www.whoishostingthis.com/compare/imagemagick/ (probably not an exaustive list)

michael-e commented 7 years ago

I hacked together something for my needs, and I have one more information to share:

Imagick is terribly slow. To be precise: Creating Imagick image objects is slow (compared to GD). Also some calculations (e.g. color profile conversion) are slow. :-(

It's OK for me, because I have a very fast server with a lot of processors (working in parallel when many images have to be created). But I don't think it would be funny on shared hosting.

animaux commented 7 years ago

Ok, thanks Michael. Sounds like performance really is the showstopper.

There are some threads on the web mentioning using exiftool to copy metadata and inject it back again after GD has done its magic. I think there might have been some built-in exif functionality in PHP.

One thing I always wished for was some kind of plugin-interface for JIT that allows to use all kinds of GD filters and commands via some scripts or extensions. Maybe even a kind of command-line field for recipes could be a good enough interface?

michael-e commented 7 years ago

The problem is: JIT 1.x is a chaos, and JIT 2 is messed up. :-)

If I had the time…

animaux commented 7 years ago

If I had the skill and the time …

michael-e commented 7 years ago

Skills? Not here. :-) 15 lines of code took me 2 days, then I realized that it doesn't work. Tomorrow is another day…