All pastes #369937 Raw Edit

Stuff

public text v1 · immutable
#369937 ·published 2007-02-24 04:03 UTC
rendered paste body
function thumbnail($image_path,$image_name,$thumb_width)
{
$thumb_path = $image_path;
echo "TO PATH "."$image_path\\$image_name<BR>";
    $src_img = imagecreatefromjpeg("$image_path\\$image_name");
    $origw=imagesx($src_img);
    $origh=imagesy($src_img);
    $new_w = $thumb_width;
    $diff=$origw/$new_w;
	echo "diff is $diff. newdidth is $new_w new_w/diff = ".($new_w / $diff);
    $new_h=$origh / $diff;
    $dst_img = imagecreate($new_w,$new_h);
    imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));

    imagejpeg($dst_img, "$thumb_path\\t".$image_name, 100);
    return true;
}