RE: [PHP] Re: resizing images comming out of blobs

From: Date: Fri, 05 Jul 2002 11:15:13 +0000
Subject: RE: [PHP] Re: resizing images comming out of blobs
Groups: php.general 
Request: Send a blank email to php-general+get-105615@lists.php.net to get a copy of this message
Please note that this will not work as expected! First of all you don't actually echo the vars to <img src...>. They should be ...imno=<?php echo $image_num ?>... Secondly the correct tag is <img src...> Third. Changing the height (or width) value in the image tag lets the client do all the work. The full image is still downloaded and then scaled by the client. Imagine <img src="mybigpic.jpg" width="100" height="100"> with an image that is 10000x10000 px and say 1MB in size. Poor modem users have to wait 5 minutes to see a thumbnail... If you have the possibility (ie. PHP and GD on the server) the best thing to do is to scale the image on the server before it is sent to the client. Even better, scale the image when it is uploaded to the server. /Joakim > -----Original Message----- > From: Dan Koken [mailto:dkokenge@netscape.net] > Sent: Friday, July 05, 2002 12:19 PM > To: php-general@lists.php.net; php-db@lists.php.net > Subject: [PHP] Re: resizing images comming out of blobs > > > Andy, > Yes I do it all the time. In this example, I do this with a > window that > has buttons across the top of a image representing size from 1 to 10. > Depending on the button they select they get a image displayed from > small to large. > > Here is a snip of code that displays the sized images. > ---------------------------- > The button name is $s. They select from 1 to 10, but can be > any increment. > $hi = $s * 100; // size in 100 pixels. (but can be any > increment) > echo " > <TABLE BORDER='15' CELLPADDING='0' > CELLSPACING='0'><TR><TD> > <image src='ft_image.php?imno=$image_num' BORDER=0 ALIGN='TOP' > height=$hi></TD></TR></TABLE> > "; > > Note: in the 'image src' you give it a program name, not the > image, and > pass some way for it to read the image from the DB. In this case the > program is ft_image.php and it passes imno. > > To didplay the photo in ft_image.php, execute the following: > > header("Content-type: image/jpeg"); > print(mysql_result($result, 0, "photo_image")); > > photo_image is name of blob field from the DB > --------------------------------- > HTH.. Good luck.. Dan. > > =========================================================== > Andy wrote: > > Hi there, > > > > I am wondering how to resize an image which is stored in a > mysql blob field. > > > > With files this workes just fine, but how to do this with > the image comming > > from blob? Has anybody done this already? > > > > Thank you for any help on that, > > > > andy > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#105615) next »