I had tried that once but then I was requested the download the file. But I gave your suggestion a shot and I am getting an error message saying there is an error in the JPG file.
BTW, looking back at my original post I accidentally left out how I was calling the function. I used this first. <img src="get_image('sub','s_sub_code', $row['s_sub_code'], 's_map')"> Then I tried get_image('sub','s_sub_code', $row['s_sub_code'], 's_map'); But I get that error in JPG message each time. So I am getting a little more closer. Here is how the function looks now. The things I tried are commented out so I won't forget what I did. function get_image($table, $pk_name, $pk_value, $blobfield) { login(); $query = 'SELECT '.$blobfield; $query .= ' FROM '.$table; $query .= ' WHERE '.$pk_name." = '".$pk_value."'"; //echo "<P>q=".$query."<P>"; $result = mysql_query( $query ) or die ("<P>Could not get image<P>"); if(mysql_num_rows($result) == 1 ) { header('Content-type: image/jpeg'); //header('Content-type: image/*'); $fileContent = mysql_result($result,0); //,$blobfield); $theimage = imagecreatefromstring ($fileContent); echo imagejpeg ($theimage); //echo $fileContent; //header('Content-type: ' . image_type_to_mime_type(IMAGETYPE_WBMP)); //image2wbmp($image); // output the stream directly } But I am trying to put it in a table in the browser. If I can get the JPG to at least show up I should be able to adjust it using a STYLE setting or TABLE. It is just getting it to output that has got me stumped so far. Thanks every so much for your help so far. Hope you can find the rest of it. Thanks. Mike "graeme" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 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 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php