note 42609 deleted from function.imagecopyresampled by aidan
| From: | aidan@php.net | Date: | Mon, 04 Oct 2004 09:42:44 +0000 |
| Subject: | note 42609 deleted from function.imagecopyresampled by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77941@lists.php.net to get a copy of this message | ||
Note Submitter: stick [at] geek [dot] hu
----
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.