note 38622 deleted from function.imagecopyresized by aidan
| From: | aidan@php.net | Date: | Mon, 04 Oct 2004 09:38:50 +0000 |
| Subject: | note 38622 deleted from function.imagecopyresized by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77907@lists.php.net to get a copy of this message | ||
Note Submitter: stu at wordpix dot ca
----
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);
?>