se è questo a cui ti riferisci...ecco cosa avevo trovato
Codice PHP:
<?
    
/*
    * $img = new Thumbnail();
    * echo $img->create_tag("../images/photos/sunflower.jpg");
    */
    
class Thumbnail
    
{
        
/*
        * e.g. '/usr/local/apache/htdocs/images/thumbnails'
        */
        
var $thumbnail_dir_internal  =  '';

        
/*
        * e.g. '/images/thumbnails'
        */
        
var $thumbnail_dir_external  =  '';

        
// Larghezza & Altezza
        
var $max_width               =  120;
        var 
$max_height              =  120;
        
        var 
$image_name;
        var 
$image_tag;
        var 
$error;
        var 
$width;
        var 
$height;


        function 
Thumbnail ()
        {
            global 
$_CONFIG;

            if (!empty(
$_CONFIG['thumbnail_dir_internal']))
            {
                
$this->thumbnail_dir_internal  =  $_CONFIG['thumbnail_dir_internal'];
            }
            if (!empty(
$_CONFIG['thumbnail_dir_external']))
            {
                
$this->thumbnail_dir_external  =  $_CONFIG['thumbnail_dir_external'];
            }
        }

        function 
create_name $parameter '' )
        {
            
$this->create$parameter );
            return 
$this->image_name;
        }

        function 
create_tag $parameter '' )
        {
            
$this->create$parameter );
            return 
$this->image_tag;
        }

        function 
create $imagefile )
        {
            if (
strlen($this->thumbnail_dir_internal)  &&  (substr($this->thumbnail_dir_internal, -1) != '/'))
            {
                
$this->thumbnail_dir_internal  .=  '/';
            }
            if (
strlen($this->thumbnail_dir_external)  &&  (substr($this->thumbnail_dir_external, -1) != '/'))
            {
                
$this->thumbnail_dir_external  .=  '/';
            }
            
$tmp_name  =  basename($imagefile);
            if (
strtolower(substr($tmp_name, -4)) == '.jpg')
            {
                
$this->image_name  =  substr($tmp_name0, -4) . '.png';
                if (!
is_file($this->thumbnail_dir_internal $this->image_name))
                {
                    
$old    =  ImageCreateFromJPEG($imagefile);
                    
$old_w  =  ImageSX($old);
                    
$old_h  =  ImageSY($old);
                    
$this->width   =  $old_w;
                    
$this->height  =  $old_h;
                    if (
$this->max_width  &&  ($this->width $this->max_width))
                    {
                        
$this->height  =  round($this->height $this->max_width $this->width);
                        
$this->width   =  $this->max_width;
                    }
                    if (
$this->max_height  &&  ($this->height $this->max_height))
                    {
                        
$this->width   =  round($this->width $this->max_height $this->height);
                        
$this->height  =  $this->max_height;
                    }
                    
$new  =  imagecreate($this->width$this->height);
                    
imagecopyresized($new$old0,00,0$this->width$this->height$old_w$old_h);
                    
ImageJPEG($new$this->thumbnail_dir_internal $this->image_name);
                    
ImageDestroy($new);
                    
ImageDestroy($old);
                }
                else
                {
                    
$arr  =  getimagesize($this->thumbnail_dir_internal $this->image_name);
                    
$this->width   =  $arr[0];
                    
$this->height  =  $arr[1];
                }
                
$this->image_tag  =  '<IMG SRC="' $this->thumbnail_dir_external $this->image_name 
                                   
'" WIDTH="'  $this->width
                                   
'" HEIGHT="' $this->height
                                   
'" BORDER="0">';
            }
            else
            {
                
$this->error  =  "Filetype not JPG";
            }
        }
    }

?>