1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| case 'gif':
if (imagetypes() & IMG_GIF)
{
$Ress_Dst = imagecreatetruecolor($W, $H);
$transparent = imagecolorallocate($Ress_Dst,255,99,140);
imagecolortransparent($Ress_Dst,$transparent);
imagecopy($Ress_Dst,$Ress_Src,0,0,0,0,$W, $H);
imagetruecolortopalette($Ress_Dst, true, 256);
imageinterlace($Ress_Dst);
}
else
{
// echo "<br>Gif non supporté";
}
break;
}
// ----------------------------------------------------------
// REDIMENSIONNEMENT (copie, redimensionne, re-echantillonne)
imagecopyresampled($Ress_Dst, $Ress_Src, 0, 0, 0, 0, $W, $H, $W_Src, $H_Src);
// ----------------------------------------------------------
// ENREGISTREMENT dans le repertoire (avec la fonction appropriee)
switch ($extension) {
case 'jpg':
case 'jpeg':
imagejpeg ($Ress_Dst, $rep_Dst.$img_Dst);
break;
case 'png':
imagepng ($Ress_Dst, $rep_Dst.$img_Dst);
break;
case 'gif':
imagegif ($Ress_Dst, $rep_Dst.$img_Dst);
break;
} |
Partager