This is my code
$immagine_sorgente = $uploadpath.$filename;
$estensione = strtolower(substr($immagine_sorgente, strrpos($immagine_sorgente, "."), strlen($immagine_sorgente)-strrpos($immagine_sorgente, ".")));
if($estensione==".jpeg" || $estensione==".jpg"){
$handle_immagine = imagecreatefromjpeg($immagine_sorgente);
}elseif($estensione==".gif"){
$handle_immagine = imagecreatefromgif($immagine_sorgente);
}elseif($estensione==".png"){
$handle_immagine = imagecreatefrompng($immagine_sorgente);
}
$width=imagesx($handle_immagine);
$height=imagesy($handle_immagine);
$newX=150;
$newY=round(($height/$width)*$newX);
$tmp_immagine = imagecreatetruecolor($newX, $newY);
$handle_immagine_adattata = imagecopyresampled($tmp_immagine, $handle_immagine, 0, 0, 0, 0, $newX, $newY, $width, $height);
imagejpeg($handle_immagine_adattata, $uploadpath.'thumb_'.$filename, 75);
imagedestroy($tmp_immagine);
the image upload works correctly, but the thumb is not created, even if the paths are correct.What's wrong?


Sign In
Create Account


Back to top









