Hello Craig & All,

As far I know, you can just echo it to a file and you will get the image file.
Of course don't forget the extention.
Just a simple "for" cycle can do it for you (inside a select).

e.g.:
    $query = "select bin_data,filetype from binary_data";
    $result = mysql_query($query);
    $numofrecords = mysql_num_rows($result);

    for ($i=1; $i<=$numofrecords; $i++)
    {
       $type = $ratas->filetype;      // used for type marking some how
       // do open a file with name +$i+content type (e.g. gif or jpg or
       whatsoever)

       $datas = mysql_fetch_object($result); // the picture stored in the database
       $data = $datas->bin_data;
       // echo it to the file opened previously
       // close the file
    }

If I would meet this, I would try this.

Any comments?

-- 
Best regards,
 Alex                            mailto:[EMAIL PROTECTED]

Wednesday, June 4, 2003, 1:26:47 PM, You wrote:

> An Image file is just text typically....

> If you know the format of the images it should be a case of extracting the
> 'text' that is the file and sending the appropriate headers...

> ----- Original Message ----- 
> From: "Craig" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 04, 2003 12:09 PM
> Subject: [PHP] Imgs in Database


>> Im converting a site from asp to php, Its db driven and some images are
>> stored in the db.
>>
>> The previous developer stored the image files in a text string format, Im
>> assuming I have to convert the text back into a binary format, anyone had
>> any experience with this or can shed some light on this for me?
>>
>> Regards,
>>
>> Craig


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to