$dim[1]) { $to_w = $maxdim;$to_h = round($dim[1]*($maxdim/$dim[0])); $horiz=0;} else { $to_h = $maxheight; $to_w = round($dim[0]*($maxheight/$dim[1])); $horiz=($maxdim -$to_w)/2; } if($dim[2]==1) {$from = ImageCreateFromGIF($draw_from);} elseif($dim[2]==2) {$from = ImageCreateFromJPEG($draw_from);} elseif($dim[2]==3) {$from = ImageCreateFromPNG($draw_from);} $thumb = imagecreatetruecolor($maxdim,$maxheight); $color = imagecolorallocate($thumb,0, 0,0); imagefilledrectangle($thumb, 0, 0, $maxdim, $maxheight, $color); #imagealphablending($thumb, true ); imagecopyresampled($thumb, $from, $horiz, 0, 0, 0, $to_w, $to_h, $dim[0], $dim[1]); if($cache) ImageJPEG($thumb,$fold.$f_name,100); ImageJPEG($thumb,'',100); chmod($fold.$f_name, 0644); //chmod($fold.$f_name, 0777); ImageDestroy($from); ImageDestroy($thumb); ?>