Image from Blob

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikidigi
    New Member
    • Jul 2007
    • 7

    Image from Blob

    PLz Help
    i have some Images in DataBase in Blob field
    but images are displayed with a Cross (X) not the actual image

    MainPage.php//code
    Code:
    <?php
    $con = mysql_connect("localhost","root","");
    if (!$con)
       die('Could not connect: ' . mysql_error());
    mysql_select_db("db1", $con);
    $image = mysql_query("SELECT * FROM userimagetable");
    while($imageResult = mysql_fetch_array($image) ){
    	?>
    	<img src="ViewImage.php?id=<?=$imageResult['id']?>" alt="Picture" /></td></tr>
    	<?php 
    }
    
    and the other file displaying image code is
    
    ViewImage.php
    <?php
    $id = $_GET['id'];
    $image = mysql_query("SELECT * FROM userimagetable WHERE Id='".$id."'");
    $imageResult = mysql_fetch_array($image);
    	header("Content-type: image/jpg");
    echo $imageResult['UserImage'];
    ?>
    plz help me
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Vikidigi:
    In the future please do not hijack someone else's thread for your question. This is not the best way to get an answer to your question because most people think that the original question has been answered.

    Please visit the Posting Guidelines for tips on how to ask questions to get the best help. I have moved your post to the start of a new thread.

    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, vikidigi.

      Try viewing ViewImage.php directly in your browser and seeing if it is outputting the image correctly. If not, try removing the content-type line to see if your script is outputting an error message that is interfering with the image output.

      Comment

      Working...