$x) { $riduzione = $width / $x; $new_height = $height / $riduzione; $new_width = $x; } } } else { if ($height > $width) { $riduzione = $width / $x; $new_height = $height / $riduzione; $new_width = $x; } else { $riduzione = $width / $x; $new_height = $height / $riduzione; $new_width = $x; if($new_height>$y) { $riduzione = $height / $y; $new_width = $width / $riduzione; $new_height = $y; } } } } $image_p = imagecreatetruecolor($new_width, $new_height); /* if($riga['tipo']=="gif") { $colore = imagecolorallocate($image_p, 0x53, 0x82, 0xC6); imagefill($image_p, 0, 0, $colore); imagefilledrectangle($image_p, 0, 0, $new_width, $new_height, 0x5382C6); } */ imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); switch($riga['tipo']) { case 'jpg': $ext = "jpeg"; imagejpeg($image_p, '', 100); break; case 'gif': $ext = "gif"; imagegif($image_p); break; } imageDestroy($image); imageDestroy($image_p); ?>