Feature #64158
closedA faster way to generate GIFBUILDER short MD5 hash inside a filename
100%
Description
It all started with not acceptable filenames during image-generation on a multi language website, after migration to 6.2.. The filename_syntax in 4.5 was: typo3temp/GB/i_{somestrings}_1a37d4a2d0.jpg
This syntax was the same on each language, thus an image is only created once for every language. In 6.2 every image receives a different hash after image_creation. After digging into typo3/sysext/frontend/Classes/Imaging/GifBuilder.php I would like to see one of the following possibilities.
Why I received a different hash per language:
Inside $this->setup there is a huge array (72k lines). This array gets serialized. The hash is generated out of the serialized array. Inside this array sys_langauge_uid exist. Thus the hash is not the same.
Possible Features / Fixes:
- move the existing hook (gifbuilder-ConfPreProcess) to later moment during image generation and make $this->setup accessible. So I can mess around inside this hook and remove the BBOX from $this->setup.
- add a new hook to image-processing to access the filename/hash generation (more flexibility on image filename generation could be a nice feature)
- create the hash out image related configurations only
I did some tests inside GifBuilder.php
I created an array out of image related configs only. This array gets serialzied to build the hash inside an image filename:
$arrayToBeSerilized = array( array_keys($this->setup), $meaningfulPrefix, $this->im, $this->w, $this->h, $this->map, $this->workArea, $this->combinedTextStrings, $this->combinedFileNames, $this->data ); GeneralUtility::shortMD5(serialize($arrayToBeSerilized));
This array will always build different hashes for every image in any constellation, afaik.
I also did some small time measurements during the hash-generation:
Average of hash-generation with $this-setup
~ 0.00049 seconds
Average of hash-generation with image related configs only
~ 0.000019 seconds
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Susanne Moog about 7 years ago
- Category changed from Image Cropping to Image Generation / GIFBUILDER
Updated by Gerrit Code Review about 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62234
Updated by Gerrit Code Review about 5 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62234
Updated by Gerrit Code Review about 5 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62234
Updated by Benni Mack about 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 39797983358cab05413db7d2bb18cac6b3f91d6c.
Updated by Simon Schmidt over 4 years ago
- Related to Bug #91449: Gifbuilder breaks with Security Update (9.5.17); until 9.5.18 performance task added
Updated by Simon Schaufelberger over 2 years ago
- Related to Bug #97212: GifBuilder renders wrong image from example typoscript in documentation added
Updated by Simon Schaufelberger over 2 years ago
This causes wrong images if you have 2 images with the same array keys but different values. Have a look at Bug #97212 where the only difference is the backColor value so this should be fixed in another way.
Updated by Simon Schaufelberger over 2 years ago
- Related to Bug #94648: GifBuilder does not recognize all changes in config when creating Hash added