Re: image resizing

From: Date: Wed, 04 Oct 2000 11:57:23 +0000
Subject: Re: image resizing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18576@lists.php.net to get a copy of this message
If you leave off the filename in your call to imagejpeg, it will send the image directly to the browser. You will also need the appropriate header then for the image. http://www.php.net/manual/function.imagejpeg.php -- Dominic webmaster@videosecrets.com wrote: > > after an ungodly amount of time, i have finally figured out and set up on my server to use > image manipulation for jpeg images. after i use imagecopyresized, i use imagejpeg to create a new, > smaller jpeg. then i display it on the web for all the world to see. now, is there a way to resize > an image and display it on the web without actually making a copy of the image on the server. it > seems to me that there should be a way to do this, but i believe there is not. the reason why i ask > this is because there will be several sites in our company that will call in images dynamically > (from an ldap server) and display them as icons. the size of the icons may vary from site to site, > and we have many sites. i would rather not flood my server with a bunch of icon images. if you can > help, please reply to this email. the code that i am currently using is as follows: > > <? > $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,imagesx($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 (#18576) next »