| 
 | 
  David - 2006-06-12 14:14:37  
First of all, excuse me about my english. 
 
In the function resize_limitwh i wonder if the good code would be this one: 
 
                function resize_limitwh($imgwidth,$imgheight,$newfile=NULL) 
                { 
                        list($width, $height, $type, $attr) = @getimagesize($this->imgFile); 
                        if($imgwidth/$width < $imgheight/$height){ 
                        if($width > $imgwidth) 
                               $image_per = floor(($imgwidth * 100) / $width); 
                        }else{ 
                        if(floor($height >$imgheight)) 
                                $image_per = floor(($imgheight * 100) / $height); 
                        } 
                        $this->resize_percentage($image_per,$newfile); 
 
                } 
 
As you can see this code compare the percentage of reduction aplied and choose the smallest one. I understand the purpose of this function is this one, isn`t it? 
  
  Sergi - 2008-08-18 20:18:52 -  In reply to message 1 from David 
First of all, thanks for your class. 
 
i have test the David code and well.. i think that is diferent the funcionallity.I prefer the original one. 
 
I have found an error. The function _createImage(). 
In the first line of this function, you call $imgFile var, but this not declared. it's necessari to change for $this->imgFile to get the class  value propierty. 
 
thanks again 
  
  Miharbi Hernandez - 2010-10-13 04:26:15 -  In reply to message 1 from David 
good class, change the line 210, because it removed some colors to PNG images, imagecolorstotal () is only for *. gif	 
 
      if($this->imgType=='GIF' ) 
	{ 
	    $colorcount = imagecolorstotal($this->_img); 
	    if ($colorcount == 0) $colorcount = 256; 
	    imagetruecolortopalette($newimg,true,$colorcount); 
	} 
  
   |