Re: GIF instead of JPG..

From: Date: Wed, 23 Mar 2005 23:43:28 +0000
Subject: Re: GIF instead of JPG..
Groups: php.general 
Request: Send a blank email to php-general+get-211380@lists.php.net to get a copy of this message
Hey! Thanks for sharing mate! I'll run it and get back to you if I have any problems. Cheers, Ryan On 3/22/2005 10:49:42 PM, Andras Kende (andras@kende.com) wrote: > > Hi, > > > I found this beautiful piece of code on the php site which make a > > > proportional thumbnail, problem is its only working with JPEG files... > and > > > not with GIFs, can someone please help me convert it to GIF too? > > > > > > I tried but got a bit confused as there are no functions that are equal > to > > > "imagecreatetruecolor" that is in the below script. > > > The below script works perfectly for jpgs: > > > > > > > > > <?php > > > // The file > > > $filename = 'test.jpg'; > > > > > > // Set a maximum height and width > > > $width = 200; > > > $height = 200; > > > > > > // Content type > > > header('Content-type: image/jpeg'); > > > > > > // Get new dimensions > > > list($width_orig, $height_orig) = getimagesize($filename); > > > > > > if ($width && ($width_orig < $height_orig)) { > > > $width = ($height / $height_orig) * $width_orig; > > > } else { > > > $height = ($width / $width_orig) * $height_orig; > > > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005

« previous php.general (#211380) next »