Actually you can input .GIF files but you can't output in that format on
most php-gd installs.  The following script shows most of the steps you're
going to need to get an image resized.  This script resizes files already
stored online but it can be changed to deal with a temp file.
Hope this helps.
Hugh

// resize routine, you may want something different
if (!isset($max)) $max=150;  // maximum dimension
if ($resize=="2") $max=200;


if ($height>$width)
 {
 $nheight=$max;
 $nwidth=$width/($height/$max);
 }
else
 {
 $nwidth=$max;
 $nheight=$height/($width/$max);
 }

//header("content-type: image/jpeg");
$image=imagecreatefromjpeg($picture); //could be imagecreatefromgif()
$image1=imagecreate($nwidth,$nheight);
imagecopyresized( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);
//imagecopyresampled( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);  // available on newer php versions but, alas, not
mine.
header("content-type: image/jpeg"); // needed if you're going to use the
result as an image on another page
imagejpeg($image1); // changing this to imagejpeg($image1,$new_image,80)
creates an image called $new_image with a quality of 80


ImageDestroy($image);
ImageDestroy($image1);
?>

----- Original Message -----
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Saturday, March 08, 2003 12:32 PM
Subject: Re: [PHP] Resizing Images Uploaded to Web Page


> > I have users uploading images to a server and need to have those files
> > resized on upload. I looked under filesystem, but found nothing like
that.
> > Anyone?
>
> Check the GD extension. You'll need that installed, and the images can't
be
> GIFs (must be JPEGs or TIFs, something like that). Anyway, there should be
a
> function in there called imagecopyresized() you'll want to check out.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
----- Original Message -----
From: "Vernon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 08, 2003 12:15 PM
Subject: [PHP] Resizing Images Uploaded to Web Page


> I have users uploading images to a server and need to have those files
> resized on upload. I looked under filesystem, but found nothing like that.
> Anyone?
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to