note 38622 added to function.imagecopyresized
| From: | stu at wordpix dot ca | Date: | Tue, 30 Dec 2003 16:35:01 +0000 |
| Subject: | note 38622 added to function.imagecopyresized | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62687@lists.php.net to get a copy of this message | ||
As a PHP newbie, I find it very helpful to have SIMPLE examples that users can just copy and paste.
Here is mine. It takes an image called "serving.jpg" (a picture of people serving dinner)
and resamples it to 10 per cent of its size. The pic and the PHP script go side by side in your
directory. By the way on my server, the GD library doesn't support GIF files any more due to
copyright problems.
<?php
header("Content-type: image/jpeg");
$background = imagecreate (80, 50);
$foreground = imagecreatefromjpeg("serving.jpg");
imagecopyresampled ($background,$foreground, 0, 0, 0, 0, 80, 50, 800, 500);
imagejpeg($background);
imagejpeg($foreground);
?>
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresized.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38622
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38622&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38622&report=yes
Search -- http://master.php.net/manage/user-notes.php