Bug #36947
closedGIFBUILDER render twice
100%
Description
Hello,
my problem is that Image Layers on a GIFBUILDER IMAGE are rendering twice.
First on the Position 0,0 of the GIFBUILDER IMAGE and then at the offset Position. See attached
TEXT Layers are ok.
Here my Code.
$imageArray = array( 'img' => 'IMAGE', 'img.' => array( 'file' => 'GIFBUILDER', 'file.' => array( 'format' => 'jpg', 'quality' =>80, 'XY' => '300,200', 'backColor' => 'white', '1' => 'IMAGE', '1.' => array( 'file' => 'fileadmin/img/right_teaser_bg.jpg', 'offset' => '10,0' ), '2' => 'IMAGE', '2.' => array( 'file' => 'fileadmin/img/main_image.jpg', 'offset' => '35,0', 'file.' => array('maxH' => 200) ), '3' => 'TEXT', '3.' => array( 'text' => 'TEST TEXT', 'fontSize' => '12', 'fontFile' => 'fileadmin/fonts/arial.ttf', 'fontColor' => 'white', 'offset' => '150,40', ), '4' => 'IMAGE', '4.' => array( 'file'=>'fileadmin/img/icon.png', 'mask'=>'fileadmin/img/mask_icon.png', 'offset' => '0,90', 'file.' => array('maxW' => 300) ) ) ) );
I use debian squeeze 6.0.4 with imagemagick 6.6.0.4 and PHP 5.3.10-1.
On TYPO3 4.5 everything runs fine.
Files
Updated by Florian Zimmermann over 12 years ago
- File f5871266ed.jpg f5871266ed.jpg added
Hi,
i have right now tried the GIFBUILDER from the wiki, and it is still the same problem.
lib.test = IMAGE
lib.test {
file = GIFBUILDER
file {
XY = 1024,768
format = jpg
quality = 88
10 = IMAGE
10.file = fileadmin/backimage.jpg
15 = IMAGE15.offset = 420,18
15.file = fileadmin/overlay.png
15.mask = fileadmin/mask.png
- 15.mask = fileadmin/mask_i.png
}
}
Updated by Florian Zimmermann over 12 years ago
Hi,
now tested with Image Magick 6.6.7.1 Same thing. Rendering Twice. Please could someone proof on his own Server what happend?
Thx in advance
Florian
Updated by Kai Tallafus over 12 years ago
Same problem here - using GraphicsMagick Version 1.2.10
Updated by Florian Zimmermann over 12 years ago
- Target version set to 4.7.1
- % Done changed from 0 to 100
ok have found the bug and fix it.
Please change
class.t3lib_stdgraphic
Function imagecopyresized
Line 442
imagecopyresized($tmpImg, $srcImg, 0, 0, 0, 0, imagesx($dstImg), imagesy($dstImg), imagesx($dstImg), imagesy($dstImg));
to
imagecopyresized($tmpImg, $dstImg, 0, 0, 0, 0, imagesx($dstImg), imagesy($dstImg), imagesx($dstImg), imagesy($dstImg));
JIHHAA!
Updated by Florian Zimmermann over 12 years ago
- Assignee set to Xavier Perseguers
Please add the fix. GIT i do not understand right now.
Updated by Florian Zimmermann over 12 years ago
- Assignee changed from Xavier Perseguers to TYPO3 Release Team
- Target version changed from 4.7.1 to 4.7.2
- % Done changed from 100 to 80
Updated by Johanna Brütsch over 12 years ago
I could solve problem also with lines below of Florian Zimmermann, before had both issues:
Black Background and twice pictures // Schwarzer Hintergrund und doppelt geladene Grafiken
Typo3 4.7.1
GraphicMagick 1.2.7
Thanks.
Updated by Gernot Ploiner over 12 years ago
It would be great if you insert this function, to generate alpha-transparent PNGs. At the Moment only Alpha-Transparent Layers in GIFBUILDER are possible.
In File: t3lib/class.t3lib_stdgraphic.php at Line 439 replace the function with this function:
function imagecopyresized(&$im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h) {
static $counter = 0;
if ($this->imagecopyresized_fix && !$this->saveAlphaLayer) {
$im_base = imagecreatetruecolor(imagesx($im), imagesy($im)); // Make true color image
imagecopyresized($im_base, $im, 0, 0, 0, 0, imagesx($im), imagesy($im), imagesx($im), imagesy($im)); // Copy the source image onto that
imagecopyresized($im_base, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h); // Then copy the $cpImg onto that (the actual operation!)
$im = $im_base; // Set pointer
} else {
if ($this->saveAlphaLayer) {
imagealphablending($im, TRUE);
imagealphablending($cpImg, TRUE);
}
imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h);
}
}
Updated by Florian Schaeffer over 12 years ago
The provided patch fixes the problem only for the first rendererd item on the page.
I refined lib.headerData.5 (graphical headline) and include a arrow in front of the headline using an offset.
- Without using your patch I get the arrow rendered twice (0,0 and on offset position) and black background
- with using your patch and removing the offset I get both elements on the page rendered with correct background and arrow at 0,0
- with using your patch and including the offset the first element on the page is correct (arrow only one time and correct background) but the second element now again has both arrows and black background
So there must be still something weird going on (global variable?, same image used twice as destination?). If I use a GIFBUILDER-object two times on one page the second one is messed up when using offset...
Updated by Florian Zimmermann over 12 years ago
Florian Schaeffer wrote:
The provided patch fixes the problem only for the first rendererd item on the page.
- with using your patch and including the offset the first element on the page is correct (arrow only one time and correct background) but the second element now again has both arrows and black background
So there must be still something weird going on (global variable?, same image used twice as destination?). If I use a GIFBUILDER-object two times on one page the second one is messed up when using offset...
Hello,
have you truncate your typo3temp/pics and typo3temp/GB folder? When i was testing the whole process i have the same thing.
First image great second image bad because of caching.
Please test it
Thx
Florian
Updated by Andreas Bouche over 12 years ago
Obviously a mistake that happened during the refactoring of the imagecopyresized method.
I came across a similar problem while using a gifbuilder-generated mask under TYPO3 4.7. Versions 4.5 and 4.6 rendered the image correctly.
Using the above fix from Florian Zimmermann or the implementation from TYPO3 4.6 fixed this Problem.
I already commented on the patchsets that apply this change at
https://review.typo3.org/#/c/9608/ and
https://review.typo3.org/#/c/6829/
For the TYPO3_4-7 branch, this change has been integrated as Revision 98f73d8b. Related issue is #26660.
Updated by Lorenz Ulrich over 12 years ago
@ Gernot Ploiner: There is only one bugfix/feature allowed in a change request. Please open an new issue for your feature request (alpha-transparent PNG).
@ Florian Zimmermann: I will take care of pushing the fix to Master (where it's already merged). Then it can be applied to the other versions.
Updated by Gerrit Code Review over 12 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11984
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/12074
Updated by Lorenz Ulrich over 12 years ago
- Status changed from Under Review to Resolved
- % Done changed from 80 to 100
Applied in changeset ab720c0e04d910b844c0ed788bbac490c803da92.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed