bonjour et bonne année
mon soucis -->
if (!empty($dest_fichier)) {
function Resize($source, $destination, $width, $height, $stretch, $quality) {
// 1 - Gestion des erreurs :
if (!file_exists($source)){
echo "Erreur : Fichier inexistant !";
return false;
}
if (!function_exists("ImageCreateFromJpeg")){
echo "Erreur : Librairie GD non installée !";
return false;
}
// 2 - Lecture de l'image et de son extension :
$ext = strtolower(strrchr(basename($source),'.'));
if($ext==".jpg" || $ext==".jpe" || $ext==".jpeg"){
$src_img=imagecreatefromjpeg($source);
}else{
if($ext==".gif"){
$src_img=imagecreatefromgif($source);
}else{
if($ext==".png"){
$src_img=imagecreatefrompng($source);
}else{
echo "Erreur : Extension incorrecte.";
}
}
}
if (!$src_img){
echo "Erreur : Lecture impossible de l'image !";
return false;
}
$w = imagesx($src_img);
$h = imagesy($src_img);
// 3 - Redimensionnement en largeur :
if (!$stretch) {
if ((($h * $width) / $w) > $height) {
$im_w = ($w * $height) / $h;
$im_h = $height;
} else {
$im_w = $width;
$im_h = ($h * $width) / $w;
}
} else {
$im_w = $width;
$im_h = $height;
}
$x = ($width-$im_w)/2;
$y = ($height-$im_h)/2;
// 4 - Création d'une image buffer :
$dst_img = imagecreatetruecolor($width, $height);
if (!$dst_img){
echo "Erreur : Buffer '".$dst_img."' non créé !";
return false;
}
$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 de la miniature en .jpg :
imagejpeg($dst_img,$destination,$quality);
return true;
}
$av=Resize($dest_fichier, $dest_dossier, 60, '', true, 75);
echo $av;
ca me renvoi -->
Erreur : Fichier inexistant !
alors que le fichier est bien la dans le dossier pouvez vous me dire d'ou viens l'erreur svp
merci
Afficher la suite