Review main Merged

3703[FEATURE] Enable the GIFBUILDER cObject to render 32-bit PNG images

Georg Großberger CR +2 V +2 Normal +91 −23 updated 06/03/13, 20:49

Commit message

Introduce the "backColor" value "transparent" to create a PNG file
that has a transparent color as background and enhance the existing
code to keep it until the final image is written to a file.

If "transparent" is set the following conditions must be met:
* png_truecolor must be set to TRUE
* reduceColors must not be set
* format must not be set to jpg or gif

If one of those conditions is not met, GIFBUILDER falls back to
its default behaviour. Already existing backColor features are not
affected by this change.

The options "transparentBackground" and "transparentColor" have no
effect if the backColor is transparent

Review

  • Code review CR +2
    • Jigal van Hemert +2
    • Georg Ringer +1
    • Jo Hasenau +1
    • Xavier Perseguers +1
  • Verified V +2
    • Jigal van Hemert +2
    • Xavier Perseguers +1

Issues 1

Files 2

Review log 20

  1. Xavier Perseguers commented on patch set 1 07/31/11, 15:07

    (6 inline comments) A few CGL stuff before starting my review

    class.t3lib_stdgraphic.php:274

    Please indent existing code anyway

    class.t3lib_stdgraphic.php:281

    Empty lines should be trimmed (easily configurable in your IDE)

    class.t3lib_stdgraphic.php:291

    Same here

    class.t3lib_stdgraphic.php:306

    same here

    class.tslib_gifbuilder.php:365

    comment: 1 more indent than code

    class.tslib_gifbuilder.php:380

    same here
  2. Georg Ringer commented on patch set 1 07/31/11, 15:07

    Looks good to me, but someone else must approve

    class.t3lib_stdgraphic.php:1398

    +1 tab

    class.tslib_gifbuilder.php:514

    space instead of tab
  3. Georg Großberger uploaded patch set 3 07/31/11, 15:07

  4. Georg Großberger commented on patch set 3 07/31/11, 15:07

    Fixed the commit message and the inline comments Jigal - The only problem I can see is if you want to copy two 32-bit PNGs onto each other. This happens in t3lib_stdGraphic::imagecopyresized, so a fix with gm / im and a slow GD fallback should not be so difficult. Especially since IM versions lower than 6 will not be supported anymore. If you accept this patch, I can do this as well or help you with your approach. I tested it with a GMENU, that has a 32-bit PNG bullet for each menu item which had a mask applied, no problem. Xavier - yes it's a problem of the extension, which is still producing a 8-bit PNG. I will release a fixed version if this patch is accepted.
  5. Xavier Perseguers commented on patch set 2 V 0 07/31/11, 15:07

    For the code, I'll give my +1 once comments are taken into account as I agree. Tested it with some site of mine generating transparent images with some text over them. Until now I had to use some close to the background color as "transparent color" and it led to relatively poor render quality for some highly colored backgrounds. I now have perfect blending with my background thanks to the transparent channel. ggspritedgmenu has a better behaviour when combining ggmenu items but it still is not perfect. Anyway, either this is a problem of this extension (I guess) that should become aware of this transparent color setting or it's a basic GD problem as described by Jigal but in all cases, it's a must-have as it finally gives (at least) some 32 bit support to TYPO3
  6. Helmut Hummel commented on patch set 2 07/31/11, 15:07

    (2 inline comments)
  7. Steffen Gebert uploaded patch set 2 07/31/11, 15:07

    Are you sure that this line is correct?

    class.tslib_gifbuilder.php:373

    Do you have some better comment than "Default behavior" ;-)
  8. Steffen Gebert commented on patch set 2 07/31/11, 15:07

    (1 inline comment) Thanks for the nice patch! I've uploaded a clean version (but it was already very, very good, from the CGL point of view..). Please configure your git to your real name, see http://wiki.typo3.org/Contribution_Walkthrough_with_CommandLine#Setting_up_your_environment Thanks for your contribution! Steffen
  9. Steffen Gebert commented on patch set 2 07/31/11, 15:07

    (1 inline comment)
  10. Xavier Perseguers commented on patch set 4 07/31/11, 15:07

    Verified; Looks good to me, but someone else must approve
  11. Georg Ringer commented on patch set 4 07/31/11, 15:07

    Looks good to me, but someone else must approve
  12. Steffen Gebert uploaded patch set 4 07/31/11, 15:07

  13. Jigal van Hemert commented on patch set 2 07/31/11, 15:07

    I'm not sure how to vote on this patch. It does something, but it won't deliver what the subject promises: PHP GD lib functions are simply not capable of keeping and combining alpha transparency. If you combine two PNG images with an alpha channel PHP can behave in two ways: it takes the transparency of both images into account and renders an image without alpha channel, or it keeps the alpha channel of one of the images. This patch initially enables the use of an alpha channel, but if the GIFBUILDER object contains IMAGE objects which contain PNG images with alpha transparency things will horribly go wrong. Comments in the PHP documentation [1] also explain this. The only way around is a very costly operation (combining the images pixel by pixel and calculating the transparency for each pixel). The real solution would be to completely rewrite the image handling of TYPO3 and use IM/GM also for combining images, etc. and using a GD fallback with possibly slow routines (I'm working on a framework for this). [1] http://www.php.net/imagealphablending
  14. Jigal van Hemert commented on patch set 4 V 0 07/31/11, 15:07

    by team member; Looks good to me, approved
  15. Jo Hasenau commented on patch set 4 07/31/11, 15:07

    Looks good to me, but someone else must approve
  16. Mr. Jenkins commented on patch set 1 07/31/11, 15:07

  17. Mr. Jenkins commented on patch set 2 07/31/11, 15:07

  18. Mr. Jenkins commented on patch set 3 07/31/11, 15:07

  19. Mr. Jenkins commented on patch set 4 07/31/11, 15:07

  20. Jigal van Hemert merged patch set 4 07/31/11, 15:07