Ho modificato uno script per generare delle thumbnails, tutto funziona ma la qualità delle immagini (essendo che il mio host non supporta le gd) è decisamente pessima.
Come posso risolvere questo problema?
Lo script è questo:
Codice PHP:
if ($noprev == "0") {
if (
$tipodifile == "image/pjpeg") {
  list(
$ww$hh) = getimagesize($HTTP_POST_FILES['upload']['tmp_name']);
  
$zz $ww/170;
  
$new_width=170;     
  
$new_height $hh/$zz;
  
$compression=99;    
  
$source_path="/web/htdocs/www.sito.com/home/files/";    
  
$destination_path="/web/htdocs/www.sito.com/home/miniature/";
      global 
$source_path;
      global 
$destination_path;
      global 
$new_width;
      global 
$new_height;
      
$destimg=ImageCreate($new_width,$new_height) or die("Problemi nelle creazioni dell'immagine");
      
$srcimg=ImageCreateFromJPEG($source_path.$image_part) or die("Problemi nell'aprire l'immagine");
      
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die("Problemi nel ridimensionamento");
      
ImageJPEG($destimg,$destination_path.$image_part,99) or die("Problemi nel salvataggio");
      }
  if (
$tipodifile == "image/jpeg") {
  list(
$ww$hh) = getimagesize($HTTP_POST_FILES['upload']['tmp_name']);
  
$zz $ww/170
  
$new_width=170;      
  
$new_height $hh/$zz;
  
$compression=99;      
  
$source_path="/web/htdocs/www.sito.com/home/files/";      
  
$destination_path="/web/htdocs/www.sito.com/home/miniature/";       
      global 
$source_path;
      global 
$destination_path;
      global 
$new_width;
      global 
$new_height;
      
$destimg=ImageCreate($new_width,$new_height) or die("Problemi nelle creazioni dell'immagine");
      
$srcimg=ImageCreateFromJPEG($source_path.$image_part) or die("Problemi nell'aprire l'immagine");
      
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die("Problemi nel ridimensionamento");
      
ImageJPEG($destimg,$destination_path.$image_part,99) or die("Problemi nel salvataggio");
      }
  if (
$tipodifile == "image/gif") {
  list(
$ww$hh) = getimagesize($HTTP_POST_FILES['upload']['tmp_name']);
  
$zz $ww/170
  
$new_width=170;     
  
$new_height $hh/$zz;
  
$compression=99;    
  
$source_path="/web/htdocs/www.sito.com/home/files/";     
  
$destination_path="/web/htdocs/www.sito.com/home/miniature/";        
      global 
$source_path;
      global 
$destination_path;
      global 
$new_width;
      global 
$new_height;
      
$destimg=ImageCreate($new_width,$new_height) or die("Problemi nelle creazioni dell'immagine");
      
$srcimg=ImageCreateFromGIF($source_path.$image_part) or die("Problemi nell'aprire l'immagine");
      
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die("Problemi nel ridimensionamento");
      
ImageGIF($destimg,$destination_path.$image_part,99) or die("Problemi nel salvataggio");
      }