Project

General

Profile

Actions

Feature #64158

closed

A faster way to generate GIFBUILDER short MD5 hash inside a filename

Added by Christian Stern over 9 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Generation / GIFBUILDER
Target version:
-
Start date:
2015-01-07
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #91449: Gifbuilder breaks with Security Update (9.5.17); until 9.5.18 performance taskClosed2020-05-20

Actions
Related to TYPO3 Core - Bug #97212: GifBuilder renders wrong image from example typoscript in documentationResolved2022-03-19

Actions
Related to TYPO3 Core - Bug #94648: GifBuilder does not recognize all changes in config when creating HashResolved2021-07-27

Actions
Actions #1

Updated by Susanne Moog over 8 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #2

Updated by Benni Mack over 8 years ago

  • Target version deleted (7.5)
Actions #3

Updated by Susanne Moog over 6 years ago

  • Category changed from Image Cropping to Image Generation / GIFBUILDER
Actions #4

Updated by Gerrit Code Review over 4 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

Actions #5

Updated by Gerrit Code Review over 4 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

Actions #6

Updated by Gerrit Code Review over 4 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

Actions #7

Updated by Benni Mack over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions #9

Updated by Simon Schmidt almost 4 years ago

  • Related to Bug #91449: Gifbuilder breaks with Security Update (9.5.17); until 9.5.18 performance task added
Actions #10

Updated by Simon Schaufelberger about 2 years ago

  • Related to Bug #97212: GifBuilder renders wrong image from example typoscript in documentation added
Actions #11

Updated by Simon Schaufelberger about 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.

Actions #12

Updated by Simon Schaufelberger about 2 years ago

  • Related to Bug #94648: GifBuilder does not recognize all changes in config when creating Hash added
Actions

Also available in: Atom PDF