$a[0] && $size>$a[1]){ if ($a[0]<$a[1]){ $size=$a[1]; } else { $size=$a[0]; } } if ($what==0){ $width=$size;$height=($a[1]/$a[0])*$size; }else{ if ($a[1]>$a[0]){ $width=($a[0]/$a[1])*$size; $height=$size; }else{ $width=$size; $height=($a[1]/$a[0])*$size; } } //echo $width." ".$height; $im=imagecreatefromjpeg($path); $im1=imagecreatetruecolor($width, $height); imagecopyresized($im1, $im, 0, 0, 0, 0, $width+1, $height+1, $a[0], $a[1]); imagejpeg($im1); imagedestroy ($im1); return $im1; } ?>