RE: [PHP] image-resize (thumbnail 150x150 code)

From: Date: Fri, 20 Apr 2001 03:48:48 +0000
Subject: RE: [PHP] image-resize (thumbnail 150x150 code)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49464@lists.php.net to get a copy of this message
this is what i use to scale down an arbitrary .GIF or .JPG image to 150x150... $image_name is the name of the original file that you want to create a thumbnail of... function save_thumb($image_name,$image_type) { global $Svar; $new_w = 150; $new_h = 150; $image_path = "/path/of/imagedir/". $image_name; $thumb_path = "/path/of/thumbdir/" . $image_name; if ($image_type == "image/pjpeg") { $src_img = imagecreatefromjpeg($image_path); } elseif($image_type == "image/gif") { $src_img = imagecreatefromgif($image_path); } $dst_img = imagecreate($new_w,$new_h); imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($s rc_img)); imagejpeg($dst_img, $thumb_path . "_t.jpg"); return 1; } > -----Original Message----- > From: Joe Stump [mailto:joe@joestump.org] > Sent: Thursday, April 19, 2001 17:18 > To: De Bodemschat > Cc: Php-General-list > Subject: Re: [PHP] image-resize/convert > > > Again - if you have imagemagick installed email me and I'll email you my little > class that does this. > > --Joe > > On Thu, Apr 19, 2001 at 10:02:47AM +0200, De Bodemschat wrote: > > Hello, > > > > I'm creating a bunch of photogalleries and wondering about the following: > > > > - Is it possible to convert an image or a whole dir with images (jpg) to 60% > > of the original imagesize using php to automate this task? > > > > I know the gd library is installed, but don't know if it supports jpg... And > > what functions do I need to use? > > >> > > gd-variables in phpinfo(): > > GD Support enabled > > GD Version 1.6.2 or higher > > FreeType Support enabled > > FreeType Linkage with TTF library > > PNG Support enabled > > << > > > > Hope you people can help. > > THanks, > > > > Bart Verbeek > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > /* Joe Stump > * Sr. PHP Developer > * http://www.Care2.com http://www.joestump.net > http://gtk.php-coder.net > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#49464) next »