note 42609 added to function.imagecopyresampled
| From: | stick at rn2 dot php dot net | Date: | Sun, 23 May 2004 17:44:22 +0000 |
| Subject: | note 42609 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69996@lists.php.net to get a copy of this message | ||
I can't get Synn at anachronique dot com's code work, so I made a little modification to
it and now it's working for me. I'm using PHP 4.3.5.
<?php
$thumbnailWidth = ; //defined here that way not with define()
header("Content-type: image/jpeg");
$filename = $_GET['filename'];
$source = imagecreatefromjpeg($filename);
$thumbX = $thumbnailWidth;
$imageX = imagesx($source);
$imageY = imagesy($source);
$thumbY = (int) (($thumbX * $imageY) / $imageX );
$dest = imagecreatetruecolor($thumbX, $thumbY);
imagecopyresampled ($dest, $source, 0, 0, 0, 0, $thumbX, $thumbY, $imageX, $imageY);
imagejpeg($dest);
imagedestroy($dest);
imagedestroy($source);
?>
...anyway I found Synn's code very useful, thanks.
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42609
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42609&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42609&report=yes
Search -- http://master.php.net/manage/user-notes.php