Fix: on peut dsormais crer des vignettes en GIF transparent

Fix: imagefill bloquait sur certain systme
This commit is contained in:
Regis Houssin
2007-10-14 11:07:42 +00:00
parent f4928122a2
commit c10da56eef

View File

@@ -3364,7 +3364,15 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
$thumbWidth=round($thumbWidth);
// Create empty image
$imgThumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
if ($infoImg[2] == 1)
{
// Compatibilit<69> image GIF
$imgThumb = imagecreate($thumbWidth, $thumbHeight);
}
else
{
$imgThumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
}
// Activate antialiasing for better quality
if (function_exists('imageantialias'))
@@ -3382,12 +3390,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
switch($infoImg[2])
{
case 1: // Gif
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); // 0, not 127 because transparent channel bugged with gif
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On proc<6F>de autrement pour le format GIF
imagecolortransparent($imgThumb,$trans_colour);
break;
case 2: // Jpg
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
break;
case 3: // Png
imagealphablending($imgThumb,false); // Pour compatibilit<69> sur certain syst<73>me
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
break;
case 4: // Bmp