mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 05:51:28 +01:00
Fix: on peut dsormais crer des vignettes en GIF transparent
Fix: imagefill bloquait sur certain systme
This commit is contained in:
@@ -3364,7 +3364,15 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
|||||||
$thumbWidth=round($thumbWidth);
|
$thumbWidth=round($thumbWidth);
|
||||||
|
|
||||||
// Create empty image
|
// 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
|
// Activate antialiasing for better quality
|
||||||
if (function_exists('imageantialias'))
|
if (function_exists('imageantialias'))
|
||||||
@@ -3382,12 +3390,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
|||||||
switch($infoImg[2])
|
switch($infoImg[2])
|
||||||
{
|
{
|
||||||
case 1: // Gif
|
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;
|
break;
|
||||||
case 2: // Jpg
|
case 2: // Jpg
|
||||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||||
break;
|
break;
|
||||||
case 3: // Png
|
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
|
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
||||||
break;
|
break;
|
||||||
case 4: // Bmp
|
case 4: // Bmp
|
||||||
|
|||||||
Reference in New Issue
Block a user