Friday, February 4, 2011

Preserve transparency when dynamically resize PNG images with joomslide

Here is a quick hack on joomslide to fix issue when transparent background PNG images are resized and a black background is used instead.

in plugins/content/joomslide.php find the line
if ($this->pluginRegistry->doCrop) $this->CalculateCropArea();
Append the following after the line above:
imagealphablending($dst_img, false);
imagefilledrectangle($dst_img, 0, 0, $this->pluginRegistry->thumbWidth, $this->pluginRegistry->thumbHeight, IMG_COLOR_TRANSPARENT);

No comments:

Post a Comment