croping an image with GD and putting it into html code
| From: | Frank Arensmeier | Date: | Tue, 15 Mar 2005 10:10:02 +0000 |
| Subject: | croping an image with GD and putting it into html code | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210750@lists.php.net to get a copy of this message | ||
Hi!
I ran into a little problem today and I would like to get some help. I create a thumbnail image with GD from a jpeg image stored on my web-server with this function:
function thumb($img_scr) {
$thumbWidth = 100;
$thumbHeight = 100;
$scourceImg = @imagecreatefromjpeg($img_scr);
$thumbImg = @imagecreate($thumbWidth, $thumbHeight);
@imagecopyresized($thumbImg, $sourceImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imagesx($img_scr), imagesy($img_scr));
@imagejpeg($thumbImg);
}
This function will return only the raw data for the new thumbnail image. Is there a way to output the thumbnail image directly to a <img> tag in my html file? Is there a way to do this without storing the thumbnail into a tmp file?
/frank
________________________________________________
Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: frank.arensmeier@nikehydraulics.se
www.nikehydraulics.com