Bug #22797

alpha transparency issue with png_truecolor=1

Added by Andreas Philippi over 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-06-03
Due date:
% Done:

0%

TYPO3 Version:
4.3
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

trying to create a GIFBUILDER object that overlays 2 png24-images.

the resulting image had no alpha-transparency.

This only happens when setting [GFX][png_truecolor] = 1

Our solution was to replace line 3022 in the file t3lib/class.t3lib_stdgraphic.php as follows:

original:
return imagecreatetruecolor($w, $h);

new:
$tmpImg = imagecreatetruecolor($w, $h);
imagealphablending( $tmpImg, false );
imagesavealpha( $tmpImg, true );
return $tmpImg;

And now it works fine. Patch is attached

typo3 configs

  • [GFX][gdlib_png] = 1
  • [GFX][png_truecolor] = 1
  • [GFX][gdlib-2] = 1

excerpt from our typoscript

temp.our_image = IMAGE
temp.our_image.file = GIFBUILDER
temp.our_image.file{
XY = 243,171
transparentBackground = 1

10 = IMAGE
10.file = fileadmin/template/main/pics/img_border.png
10.file.width = 243
10.file.height = 171

20 = IMAGE
20.file.import.field = image
20.file.import = uploads/pics/
20.file.import.listNum = 0
20.file.width = 217c
20.file.height = 150
20.offset = 10,7
(issue imported from #M14602)

patch_truecolor_png_alpha_transparency.diff View (359 Bytes) Administrator Admin, 2010-06-03 11:55

14602.patch View (1.3 KB) Administrator Admin, 2010-07-25 23:27


Related issues

Related to TYPO3 Core - Feature #28405: Enable GIFBUILDER to generate 32-bit PNG images Closed 2011-07-23

History

#1 Updated by Jigal van Hemert over 7 years ago

14602.patch fixes this in trunk (4.5).
An extra TS option activates the alphachannel. Example code:

10 = IMAGE
10 {
wrap = <div style="background: #ddd;"> | </div>
file = GIFBUILDER
file {
XY = 100,99
format = png
alphaChannel = 1
5 = BOX
5 {
dimensions = 50,10,50,50
color = yellow
opacity = 20
}
10 = TEXT
10 {
text = TESTimg
fontSize = 24
offset = 10,40
fontColor = red
}
}
}

This creates an image with transparent background, a semi-transparent yellow box and on top red text. The grey CSS background shows the transparency of the PNG image.

#2 Updated by Alexander Opitz over 4 years ago

  • Category deleted (Communication)
  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

#3 Updated by Alexander Opitz about 4 years ago

  • Is Regression set to No

No response in over 3 month so closing this issue.

If you think this issue should be reopened, then write to the bugs mailing list.

#4 Updated by Alexander Opitz about 4 years ago

  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF