Re: Output Image from Db to Browser

From: Date: Tue, 18 Jan 2005 05:25:23 +0000
Subject: Re: Output Image from Db to Browser
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-25367@lists.php.net to get a copy of this message
Sorry running from memory here. You need to set your output headers to display a jpg not text. So you need something like: header("Content-type: image/jpg"); This will display the image on its own, if you need to embed the image in a web page you need a little more trickery. I'll try to look it up for you. But this should at least get you going on testing getting your image from the database. graeme MikeA wrote:
I am trying to output a JPG image to the browser without creating a file. I have tried several things but nothing seems to work. I sure could use a whole lot of help right now! LOL Going crazy trying to figure this out. But I know there are PHP gurus out there that will have the answer in 2 seconds. Hopefully I'll be at that level someday too! The image comes from a MySQL Blob. The closest I get is a string of garbage on the browser display. I cannot get it to display a pictures. Suggestions, comments, help, almost anything is appreciated. PLEASE help me! Project due in a week. Thanks in advance. Mike if( mysql_num_rows($result) == 1 ) { //header('Content-type: image/*'); $fileContent = mysql_result($result,0); //,$blobfield);
    echo $fileContent;
//$theimage = imagecreatefromstring ($fileContent); //echo imagejpeg ( $theimage);
-- Experience is a good teacher, but she sends in terrific bills. Minna Antrim

« previous php.windows (#25367) next »