bonjour a tous
j'ai un code php pour redimensionner les images jpg, je l'ai utilisé avec succes avec l'hebergeur Alice. J'ai changé d'hebergeur "1and1", le code me genere bien les image mais il manque des couleurs.
d'ou pourait venir ces erreurs ?
voici le code :
<?
// -----------------------------------------------------------------------
// Fonction de redimensionnement d'image
// -----------------------------------------------------------------------
function Resize($source, $destination, $width, $height, $quality) {
// 1 - Gestion des erreurs
if (!file_exists($source)) return "Error : File not exist !";
if (!function_exists("ImageCreateFromJpeg")) return "Error : Librairie GD non instalée !";
// 2 - Lecture de l'image
$src_img=ImageCreateFromJpeg($source);
if (!$src_img) return "Erreur : Lecture impossible de l'image ".$source." !";
$w = ImageSX($src_img);
$h = ImageSY($src_img);
// 3 - Redimensionnement en largeur
if ((($h * $width) / $w) > $height) {
$im_w = ($w * $height) / $h;
$im_h = $height;
} else {
$im_w = $width;
$im_h = ($h * $width) / $w;
}
$x = ($width-$im_w)/2;
$y = ($height-$im_h)/2;
// 4 - Création d'une image buffer
$dst_img = imagecreate($width, $height);
if (!$dst_img) return "Erreur : Buffer non créé : ".$dst_img;
$bgc = imagecolorallocate($dst_img, 255, 255, 255);
imagefilledrectangle($dst_img, 0, 0, $width, $height, $bgc);
imagecopyresized($dst_img,$src_img,$x,$y,0,0,$im_w,$im_h,$w,$h);
// 5 - Enregistrement du fichier
imagejpeg($dst_img,$destination,$quality);
}
?>
merci d'avance

.