AW: [PHP] image resizing

From: Date: Wed, 04 Oct 2000 09:04:17 +0000
Subject: AW: [PHP] image resizing
Groups: php.general 
Request: Send a blank email to php-general+get-18546@lists.php.net to get a copy of this message
you need to split that in two files. first a php, that does the resize and second a html that has a img-tag with src=image.php3?filename=younameit.jpg then you use Header("Content-type: image/jpeg"); $imagefile=createimagefromjpeg($filename); //??? have a look at php.net's manual) /* do resize here */ imagejpeg($dst_img,'',80); // note the different parameters /* cleanup */ but be carefull, because that puts a big load on my server..... so resizing hundereds of images could be a bad idea. you could implemet some chaching, like creating these thumbnails in a seperate directory and check for their existens first.... if you do, please send me you code :-] sebastian p.s.: you can find all this at www.php.net > > <? > $imagefile = "images/990209_005.jpg"; > $src_img = imagecreatefromjpeg($imagefile); > $new_w = imagesx($src_img)/4; > $new_h = imagesy($src_img)/4; > $dst_img = imagecreate($new_w,$new_h); > imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,image > sx($src_img),imagesy($src_img)); > imagejpeg($dst_img, "images/temp.jpg"); > ImageDestroy($dst_img); > ImageDestroy($src_img); > echo "<img src=images/temp.jpg>\n"; > ?> >

« previous php.general (#18546) next »