All pastes #514873 Raw Edit

Rob

public php v1 · immutable
#514873 ·published 2007-05-27 23:22 UTC
rendered paste body
<?phprequire_once "config.php";$image = clean(@$_GET['_img']);$filename = null;if(file_exists(IMAGE_BASE.$image)){  $filename = IMAGE_BASE.$image;  $filename2 = $image;}else $filename = IMAGE_BASE."error.jpg";if(!file_exists(THUMB_LOC."thumb_".$filename2.".jpg")){  $width = MAX_WIDTH;  $height = MAX_HEIGHT;  //$info = getimagesize($filename);  //header("Content-type: ".$info['mime']);  list($width_orig, $height_orig) = getimagesize($filename);  $ratio_orig = ($width_orig / $height_orig);  if($width / $height > $ratio_orig) $width = $height * $ratio_orig;  else $height = $width / $ratio_orig;  $image_p = imagecreatetruecolor($width, $height);  $image = @imagecreatefromjpeg($filename);  if(!$image) $image = @imagecreatefromgif($filename);  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);  imagejpeg($image_p, THUMB_LOC."thumb_".$filename2.".jpg", 100);  //@imagedestroy($image_p);  //@imagedestroy($image);}echo file_get_contents(THUMB_LOC."thumb_".$filename2.".jpg");?>