xperseguers / t3ext-image_autoresize

TYPO3 Extension image_autoresize. Simplify the way your editors may upload their images.
https://extensions.typo3.org/extension/image_autoresize
GNU General Public License v3.0
16 stars 22 forks source link

Setting keep_metadata to false is not respected #74

Closed dogawaf closed 1 year ago

dogawaf commented 1 year ago

Hi

On the TYPO3 setup, without image_autoresize, metadata are ignored thanks to the default option TYPO3_CONF_VARS/GFX/processor_stripColorProfileCommand=+profile '*'.

If I install image_autoresize and if I set keep_metadata to false, and import an image with exif description, that description is stored into sys_file_metadata. I would expect setting keep_metadata to false strip out any image's metadata.

xperseguers commented 1 year ago

That's the case, the file will not retain the EXIF data if you set keep_metadata to false. However, as documented, the extension will still extract everything it can while resizing, before stripping metadata.

If you choose to keep_metadata, then the EXIF will be extracted exactly the same way, but in addition your resized file will keep those metadata in the file itself.

I don't really see why you wouldn't want to put everything you can into sys_file_metadata. I mean if you make use of it, you have the info, if you don't, that doesn't really take much place anyway...

dogawaf commented 1 year ago

Alright, I misunderstood the keep_metadata option. keep_metadata=false keeps the default +profile '*' in the IM command, so the metada are stripped out from resulting image file, but the metadata are still stored in sys_file_metadata.

The use case is: the customer buys an image on shutterstock, this image is filled with many keywords. The image is uploaded in TYPO3, and displayed in a textmedia. The shutterstock keywords are displayed under the image. The customer does not wan't to keep those keywords, because they describe the image in a wrong language, and not with a proper sentence. He does not wan't either to edit manually the metadata to clear the file.

image

A workaround would be to patch the extension in order to remove the populateMetadata eventlistener.

--- a/Classes/EventListener/CoreResourceStorageEventListener.php
+++ b/Classes/EventListener/CoreResourceStorageEventListener.php
@@ -187,6 +187,12 @@
     public function populateMetadata(AfterFileAddedEvent $event): void
     {
         if (is_array(static::$metadata) && !empty(static::$metadata)) {
+            // The content of the meta "description" stored in the file should not be kept.
+            // WARNING: For the key to be taken, it must contain a value.
+            static::$metadata['description'] = ' ';
+            static::$metadata['title'] = ' ';
             \Causal\ImageAutoresize\Utility\FAL::indexFile(
                 $event->getFile(),
                 '', '',
dogawaf commented 2 months ago

Won't fix