[TYPO3-core] RFC: Bug #6261: Crop-Scaling the same image with different dimensions might produce wrong files

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Sep 4 16:33:20 CEST 2007


Hi,

this is a SVN patch request.

Branch: trunk, TYPO3_4-1

Problem:
If the same image needs to be generated more than once by an "IMAGE"
with different crop-scale configurations (width=XXc or height=YYc), it
might occur that the same hash will be generated for both versions, so
that the second crop-scaling will render the same image which was
produced with the first crop-scaling.

How to reproduce:
Test with an 800x600 image (the proportions are important!):

page = PAGE
page {
  10 = IMAGE
  10 {
    file = fileadmin/Blaue_Berge.jpg
    file.width = 80c
    file.height = 80c
    wrap = <div>Image 80x80:<br/>|</div>
  }
  20 < .10
  20.file.width = 100c
  20.file.height = 80c
  20.wrap = <div>Image 100x80:<br/>|</div>
}

Expected is two different files (and hashes), but we get the same hash
twice (thus the same 80x80 file).

Why this happens:
The problem is that in both situations the same scaled-down version of
the file will be generated (107x80) before they are cropped down later
by imagemagick. Since only the scale-down + "crop-percentage" will be
used to generate the hash, it will render both files twice.

Solution:
We need to add the information about the destination crop width/height
in the hash so that we end up with two different files. The patch does
that. This will only happen for crop-scaled images, all other hashes
will be left untouchted. Cleaning up the typo3temp/pics/ might be
recommended after upgrading.

Reference:
http://bugs.typo3.org/view.php?id=6261

Cheers,
Ernesto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-6261-cropscale.diff
Type: text/x-diff
Size: 925 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070904/4aab0289/attachment.diff 


More information about the TYPO3-team-core mailing list