Bug #19751
closedStrip uploaded images headers
0%
Description
Images can hold miscellaneous information (profiles, comments) in its headers.
The idea is to introduce config option:
$TYPO3_CONF_VARS['GFX']['im_strip_uploaded_images'] = 1;
which would strip such headers from images when uploading them to Typo3.
Since ImageMagick cannot strip headers without recompressing the image (http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=10895&start=0&st=0&sk=t&sd=a), we should use 'jpegtran' command (part of libjpeg package for lossless transformation) for jpegs and im 'convert' for other formats:
- Command for jpegs: jpegtran optimize -copy none -outfile out.jpg in.jpg Command for other formats: convert -strip in.png out.png
And then replace the original image if the resulting is smaller.
Please find attached shell script for stripping existing images. The same logic should be implemented in Typo3 itself, triggered on every image upload.
You can try the script using 'test' switch:
./strip_image_headers.sh test /typo3/typo3temp
I would recommend running the following commands on the existing Typo3 installation (backup everything first of course):
./strip_image_headers.sh typo3temp
./strip_image_headers.sh typo3temp/pics
./strip_image_headers.sh uploads
./strip_image_headers.sh uploads/pics
./strip_image_headers.sh uploads/media
and for all other directories where you have uploaded your own images.
You can later fix ownership of files if necessary.
Statistics for 96187 images:
- Before: 2176 MB
- After running the script: 1243 MB
- Gain: 43% smaller images!
Related to #19748.
(issue imported from #M10032)
Files