Re: image calculation problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks mate, it works perfectly.
-Ryan



On 4/13/2005 11:35:23 PM, Philip Hallstrom (php@xxxxxxxxxxxxxxx) wrote:
> see below...
>
>
>
> > Basically I am trying to make a thumb where the width is 87px...I dont
>
> > care what the height is, heres the code:
>
> >
>
> > function prop_thumb_height()
>
> > {
>
> > // The file
>
> > $filename = 'cat.jpg';
>
> >
>
> > // Content type
>
> > header('Content-type: image/jpeg');
>
> >
>
> > // Get new dimensions
>
> > list($width_orig, $height_orig) = getimagesize($filename);
>
> >
>
>
>
> $width = 87;
>
>
>
> // note
> I'm not checking if $width_orig == 0
> $scale_by = $width / $width_orig;
>
> $height = floor($height_orig * $scale_by + 0.5);
>
> > // Resample
> > $image_p = imagecreatetruecolor($width, $height);
> > $image = imagecreatefromjpeg($filename);
> > imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);
> >
> > // Output
> > imagejpeg($image_p, 'ryan.
> jpg', 100);
> > }
> >



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux