[Typo3-dev] function imagecopyresized

Kasper Skårhøj kasper at typo3.com
Fri Apr 23 18:12:26 CEST 2004


Hi Michael.

I have fixed this now:

$TYPO3_CONF_VARS["GFX"]["gdlib_2"] = 'no_imagecopyresized_fix';




If you want the explanation of why, then just read the source code
comment:
(It has definitely been true with a past PHP version if it isn't
anymore!)

	 * Alternative function for using the similar PHP function
imagecopyresized(). Used for GD2 only.
	 *
	 * OK, the reason for this stupid fix is the following story:
	 * GD1.x was capable of copying two images together and combining their
palettes! GD2 is apparently not.
	 * With GD2 only the palette of the dest-image is used which mostly
results in totally black images when trying to
	 * copy a color-ful image onto the destination.
	 * The GD2-fix is to
	 * 		1) Create a blank TRUE-COLOR image
	 * 		2) Copy the destination image onto that one
	 * 		3) Then do the actual operation; Copying the source (top image)
onto that
	 * 		4) ... and return the result pointer.
	 * 		5) Reduce colors (if we do not, the result may become strange!)
	 * It works, but the resulting images is now a true-color PNG which may
be very large.
	 * So, why not use 'imagetruecolortopalette ($im, TRUE, 256)' - well
because it does NOT WORK! So simple is that.



- kasper


On Tue, 2004-03-30 at 12:19, Michael Stucki wrote:
> Hi Thomas,
> 
> > This makes the Image bad:
> > $this->makeEffect($im, Array('value'=>'colors=256')); // Reduce
> > colors to 256 - make SURE that IM is working then!
> 
> The whole function provides a replacement for the imagecopyresized function
> in PHP. I don't know why but Kasper expects this not to be working with GD2,
> therefore he created this alternative function.
> 
> However I have found out that this would make absolutely no problems and
> work fine even with GD2!
> 
> You can fix the problem by commenting out all the stuff from 'if(...) {' up
> to the else statement and just leave this single line there:
> 
> imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h);
> 
> Hope this helps. I hope Kasper will read my mail and add a switch to the
> config where one can choose if he wants to use the replacement or not.
> 
> Cheers - michael
> 
> ----------  Forwarded Message  ----------
> 
> Subject: imagecopyresized
> Date: Montag, 19. Januar 2004 13.24
> From: Michael Stucki <mundaun at gmx.ch>
> To: kasper at typo3.com
> 
> Dear Kasper,
> 
> I am close to finish fully working Debian packages that contain full GIF
> support.
> 
> My problem is that there is one outstanding problem with the alternative
> imagecopyresized function you have created.
> 
> I don't know why, but I couldn't make it work. Apache simply died before
> sending any output. The die happens in this function, but I don't know more
> about that.
> 
> Anyway. After a few hours of playing around with that, I have finally found
> out that PHPs original imagecopyresized function would be fully working! (At
> least in the install tool - there are no problems with the checks.)
> 
> Since this is hardcoded and TYPO3 never uses this function when GDlib2 is
> used, I would like to ask you to to add a new option where I can override
> this.
> 
> Thanks in advance.
> 
> Kind regards
> - michael
> 
> -------------------------------------------------------
-- 
Best regards

- kasper

--------------------
It's not a bug, it's a missing feature.






More information about the TYPO3-dev mailing list