Bonjour,
Voila j'essaie de redimensionner une image au moment de l'upload mais ça marche pas et ça m'affiche plein des caractère spéciaux à l'endroit ou j'appelle la fonction qui redimensionne.
Voici ma fonction :
function size($file){
$width=0;
$height=0;
$size = getimagesize($file);
$c=$size[0]/$size[1];
if($size[0]>=$size[1])
{
$width=500;
$height=round($width/$c);
}
elseif($size[0]<$size[1])
{
$height=500;
$width=round($height*$c);
}
$duplicate = imagecreatefromjpeg($file);
$new_image = imagecreatetruecolor ($width, $height);
imagecopyresampled ($new_image,$duplicate,0,0,0,0,$width,$height,$size[0],$size[1]);
imagejpeg($new_image);
header('Content-Type: image/jpeg');
}
Et je l'appelle comme ça :
$upload="uploads/photos/".$vref.".jpg";
size($upload);
Si vous voyez où est le problème