If I understand you right, then what you want is just impossible.
You have to give a source as filepath. You can't put the binary picture data
into the same output.
What you could is to have a file which calls itself with params telling it
to output now the image instead of the html e.g. example.php which produces
without given parameters html like
<HTML><IMG SRC="example.php?showimage=true"></HTML>
You can then check in the example.php file if $showimage is set. if it is
set then you call a function to send correct header and binary data and die
afterwards (better: exit ;-)
But due hold it more simple I would hardly suggest you to have image-output
functions in a separate file. You can still use that file for all images in
your database

If I misunderstood you and you just want a sample code for outputting
picture-data then look at this:
<?php #make sure that above this line nothing is printed to the browser
    require("your_mysql_access_routines.php");

    header("content-type: image/jpg"); #replace jpg with gif or png or
whatever you want
    $result = mysql_query("SELECT imageBinaryField FROM imagesTable WHERE
id='$id'); #you can give $id as parameter to the file
    $row = mysql_fetch_array($result);
    echo $row['imageBinaryField'];
    #don't print anything below this to the browser
?>

I hope I could help you
Stefan Rusterholz, [EMAIL PROTECTED]
----------------------------------
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
----------------------------------
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
----------------------------------
----- Original Message -----
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Tuesday, November 13, 2001 3:32 PM
Subject: [PHP] Mysql and Images


> His list,
>
> I have some images stores in a mysql database and now i need to recover
them
> to put in a html. My question is there's a way to do this in the same
page,
> I mean, withou the need to buil another php page that process th image?
> Something like a function that output the image to the <img src=> in the
> html.
>
> Thank's in advance
>
> Rodrigo Peres
> --
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to