English
I’ve added some code to thumb plugin that allows the get transparent thumbs with GIFs and PNGs files.
I’ve taken this code from a comment of the imagecopyresampled PHP function.
Open fp-plugins/thumb/plugin.thumb.php with a text editor and replace:
$scaled = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $infos[0], $infos[1]);
with
$scaled = imagecreatetruecolor($new_width, $new_height);
/*
* If gif or png preserve the alpha channel
*
* Added by Piero VDFN
* Kudos to http://www.php.net/manual/en/function.imagecopyresampled.php#104028
*/
if($infos[2]==1 || $infos[2]==3) {
imagecolortransparent($scaled, imagecolorallocatealpha($scaled, 0, 0, 0, 127));
imagealphablending($scaled, false);
imagesavealpha($scaled, true);
$output=$infos[2]==3 ? 'png' : 'gif';
} else {
$output='jpg';
}
imagecopyresampled($scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $infos[0], $infos[1]);
Now, replace some lines belove imagejpeg($scaled, $thumbpath); with: … [Leggi il resto]