Re: Funky image stuff...
| From: | Matt McClanahan | Date: | Thu, 12 Oct 2000 20:34:52 +0000 |
| Subject: | Re: Funky image stuff... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19879@lists.php.net to get a copy of this message | ||
On Thu, 12 Oct 2000, Shane McBride wrote:
> I am just starting to explore the image functions within PHP.
(snip)
> How come this doesn't create any html, and won't echo the $height, and
> $width? It looks like it will just create a .jpg that can only be
> displayed on a page by itself?
ImageJPEG dumps the image out as raw data. The only way to make use of it
would be to put a Header('Content-type: image/jpeg') above it. Then when
you run the script, it outputs the image. To do what you want, you'd have
to use two scripts, or just put some control structure into a single one.
For example..
<?php
if ($action == 'draw')
{
$im = ImageCreateFromJPEG('file.jpg');
Header('Content-type: image/jpeg');
ImageJPEG($im,'',100);
}
else
{
echo '<img src="' . $PHP_SELF . '?action=draw"
border="0">';
}
?>
> My main goal is to take a .jpg uploaded by a user and limits it's
> display size to less than 150px.
So you'd want to insert some logic in the if ($action == 'draw') case to
do the resizing.
Matt