All pastes #171789 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-09-15 17:03 UTC
rendered paste body
$tmp=split("/",$match);
$file3 = end($tmp);

$save = "./thu/${file3}.thumb.jpg";

if(!file_exists($save))
{
 $file2 = "${match}.jpg";
 header('Content-type: image/jpeg') ;
 list($width, $height) = getimagesize("$file2") ;
 $gg = 100 / $width;
 
 $modwidth = $width * $gg;
 $modheight = $height * $gg;
 $tn = imagecreatetruecolor($modwidth, $modheight) ;
 $image = imagecreatefromjpeg($file2) ;
 imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;

 imagejpeg($tn, $save, 100) ;
 echo "file $save was created<br>";
}