$_height_min_)) { $new_h = $_height_min_; $new_w = (int)($info[0]*($new_h/$info[1])); } // Définition des points d'origine de destination $dst_x = 0; $dst_y = 0; $dst_l = $new_w; $dst_h = $new_h; if ($_centrage != false) { $dst_x = (int)(($_width_min_ - $new_w) / 2); $dst_y = (int)(($_height_min_ - $new_h) / 2); $dst_l = $_width_min_; $dst_h = $_height_min_; } // Création de l'image switch (strtolower($_fichier['extension'])) { case 'jpg' : header("Content-type: image/jpg"); $dst_img = imagecreatetruecolor($dst_l, $dst_h); $c_fond = imagecolorallocate($dst_img, 255, 255, 255); imagefill($dst_img, 0, 0, $c_fond); $src_img = ImageCreateFromJpeg($_image_); imagecopyresampled($dst_img,$src_img,$dst_x,$dst_y,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); $img_cache = Imagejpeg($dst_img, $fichier_cache, $_quality_); $img = Imagejpeg($dst_img, '', $_quality_); break; case 'gif' : header("Content-type: image/gif"); $dst_img=ImageCreate($new_w,$new_h); $src_img=ImageCreateFromGif($_image_); ImagePaletteCopy($dst_img,$src_img); ImageCopyResized($dst_img,$src_img,$dst_x,$dst_y,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); $img_cache = Imagegif($dst_img, $fichier_cache, $_quality_); $img = Imagegif($dst_img,'', $_quality_); break; case 'png' : header("Content-type: image/png"); $dst_img=ImageCreate($new_w,$new_h); $src_img=ImageCreateFromPng($_image_); ImagePaletteCopy($dst_img,$src_img); ImageCopyResized($dst_img,$src_img,$dst_x,$dst_y,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); $img_cache = Imagepng($dst_img, $fichier_cache, $_quality_); $img = Imagepng($dst_img,'', $_quality_); break; } } ?>