Codice PHP:
	
@move_uploaded_file($_FILES["upfile"]["tmp_name"][0], "$upload_dir/$nome_file1")
                  or die("Non riesco a spostare il file");
                  list($width, $height, $type, $attr) = getimagesize("$upload_dir/$nome_file1");
                 if($height>148)
                {
                $newwidth=ceil(148*$width/$height);
                $thumb = imagecreatetruecolor($newwidth,148);
                switch($type)
                {
                  case 1: 
                        $source = imagecreatefromgif("$upload_dir/$nome_file1");
                        imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth,148, $width, $height);
                        imagegif($thumb, "$upload_dir/$nome_file1", 75);
                        break;
                  case 2: 
                        $source = imagecreatefromjpeg("$upload_dir/$nome_file1");
                        imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth,148, $width, $height);
                        imagejpeg($thumb, "$upload_dir/$nome_file1", 75);
                        break;
                  case 4: 
                        $source = imagecreatefromwbmp("$upload_dir/$nome_file1");
                        imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth,148, $width, $height);
                        imagewbmp($thumb, "$upload_dir/$nome_file1", 75);
                        break;
                } 
                imagedestroy($thumb);
                }
                list($width, $height, $type, $attr) = getimagesize("$upload_dir/$nome_file1");
                $newheight=ceil(94*$height/$width);
                $thumb = imagecreatetruecolor(94,$newheight);
                switch($type)
                {
                  case 1: 
                        $source = imagecreatefromgif("$upload_dir/$nome_file1");
                        imagecopyresized($thumb, $source, 0, 0, 0, 0, 94,$newheight, $width, $height);
                        imagegif($thumb, "$upload_dir/anteprima/$nome_file1", 75);
                        break;
                  case 2: 
                        $source = imagecreatefromjpeg("$upload_dir/$nome_file1");
                        imagecopyresized($thumb, $source, 0, 0, 0, 0, 94,$newheight, $width, $height);
                        imagejpeg($thumb, "$upload_dir/anteprima/$nome_file1", 75);
                        break;
                  case 4: 
                        $source = imagecreatefromwbmp("$upload_dir/$nome_file1");
                        imagecopyresized($thumb, $source, 0, 0, 0, 0, 94,$newheight, $width, $height);
                        imagewbmp($thumb, "$upload_dir/anteprima/$nome_file1", 75);
                        break;
                  default: copy("$upload_dir/$nome_file1","$upload_dir/anteprima/$nome_file1"); 
                } 
                imagedestroy($thumb); 
 
Finora ha sempre funzionato.