Reginald Mullin <[EMAIL PROTECTED]> wrote:
> Now I understand why I'm getting the error.  What I'd like to know is how to
> get around it?  Basically what I want is the image in the DB to be displayed
> like any regular image would be on an HTML page, i.e. <img
> src="imageGoesHere" height="x"  width="x" border="x">.  However, I still
> need to pass the HTML headers.

you need to create a page that justs returns the image (as your example
code did), and use that as the target of the 'src' attribute. you can't
send the binary image at the same time as you send the html. so the
script that sent the html page would look something like:

  $res = mysql_query($query)
  while ($obj = mysql_fetch_object($res)) {
    echo '<img src="get-image.php?id=', $obj->id, '" />';

and get-image.php would look something like:

  $res = mysql_query("SELECT type,image FROM table WHERE id=$id");
  $obj = mysql_fetch_object($res);
  header("Content-type: ".$obj->type);
  echo $obj->image;


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to