Re: Storing image in database

From: Date: Tue, 31 Aug 2004 21:16:36 +0000
Subject: Re: Storing image in database
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-195342@lists.php.net to get a copy of this message
I got the idea .. and I will work on it thanks a lot "Jim Grill" <jgrill@web-1hosting.net> wrote in message news:004801c48f01$61f211d0$0301a8c0@necronomicon... > > Dre wrote: > > > line 8 is <?php > > > > > > just that .. and the code before it is the following > > > > > > //================================================== > > > <html> > > > <head> > > > <title>Untitled Document</title> > > > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > > > </head> > > > > > > <body> > > > //================================================== > > > > > > > That is the output I mentioned. > > > > And output either html OR image, you cannot output both. Try yourself, > > open a image file (gif, jpg...) in a text editor and put html code in > > it, then save it. Obviosly, you'll get broken image file. > > > > As others have mentioned, you cannot output *anything* at all before > modifying headers. If your script outputs even a space, headers are sent. > Headers can only ever be sent one time per request. The solution: make a > separate request for the image. > > To get around this problem put your image fetching code into a separate > script and call it with an image tag. Ideally, you would have saved the > image sizes in a separate column so you might select only the id (or name of > the image) and the size in your main script and then call the second image > fetching script like so: > <img src="image.php?img_id=$id" width="$width" > height="$height" border="0" > /> > > The $id, $width, and $height would have come from your db. Save the actual > fetching of the image itself for image.php. > > Good luck and have fun! > > Jim Grill > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

« previous php.general (#195342) next »