<?php
        Header("Content-type: image/jpeg");

        $src_img = imagecreatefromjpeg($fileURL);

        $aspect=imagesy($src_img)/imagesx($src_img);

        $new_w = $thumbSize;
        $new_h = $new_w * $aspect;

        $dst_img = imagecreate($new_w,$new_h);


imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),i
magesy($src_img));

        imagejpeg($dst_img,'',$quality);
?>

All you need to go is set up $fileURL and $thumbSize and this *should* work
flawlessly.  When you get it working try using "Resampled" instead of
"Resized" - but you need gd 2.0.1 for that to work, and even then it has
issues it would seem.

- seb

-----Original Message-----
From: Jan [mailto:[EMAIL PROTECTED]]
Sent: 26 August 2001 18:22
To: [EMAIL PROTECTED]
Subject: [PHP] How to create thumbnails?


For thumbnail creation I would need to know how I scale a loaded image or
better:
How do I copy a scaled version of an image created with imagecreatefromjpeg
onto a background I have previously created?

Jan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to