List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:August 9 1999 8:23pm
Subject:Re: binary mysql attempt??
View as plain text  
Mick Hanna wrote:
> im going to try storing binary jpg/gif  (200x150) pics into a mysql db
> for the first time.
> anything i should know before attempting this?
> what field type etc would be best
> how can i call it to view on a web page in ansi c?
> would soething like:
> printf("<img src=\"%s\">",row[5]);
> be ok??
> i imagine not :(

Hi Mick

You should use one of the BLOB types.
Befor inserting, you have to escape the characters ' " \ 
But when getting it out, you will get the correct binary without escaping.

If your pictures are larger than 100 KBytes, then you should store them in the filesystem,
not in mysql.

In one mysql 3.22.xx table you can only store up to 4 GBytes.
This can be limited by your OS to 2 GBytes.
So you only can store less than 20000 pictures a 100 KBytes in one table.

To view the picture in a HTML page, you have to include a normal <img>-tag, but the
URL for the image is another CGI program which pulls the binary data out of mysql.
In this CGI you have to set the CONTENT-TYPE to image/gif or image/jpg.

Hope this helps

binary mysql attempt??Mick Hanna9 Aug
  • Re: binary mysql attempt??Christian Mack9 Aug
  • Re: binary mysql attempt??sasha10 Aug
Re: binary mysql attempt??Andrey Muratov9 Aug