List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:August 12 1999 7:20am
Subject:Re: Bynary field?
View as plain text  
On Do, 1999-08-12 00:04:32 -0700, Jose Albert wrote:
> This is my first mail in this group.

Welcome! :)

> Can some body let me know if MySql supports graphics fields?

There's no special column type for images, but for any kind of binary
data just use some of the BLOB types (Binary Large OBjects), only
depending of the desired maximum size:
   TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB

See:
  MySQL manual "7.2.1 Column type storage requirements", e.g.
  <URL: http://www.mysql.com/Manual_chapter/manual_Reference.html#Storage_requirements
>

Also see:
  MySQL manual "7.2.7.2 The BLOB and TEXT types", e.g.
  <URL: http://www.mysql.com/Manual_chapter/manual_Reference.html#BLOB >


There are no special functions to get only a part out of a BLOB (or a
part of an image), one always has to retrieve the BLOB as a whole.


A short summary by Christan Mack:
| > im going to try storing binary jpg/gif (200x150) pics into a mysql
| > db for the first time.
| 
| You should use one of the BLOB types.
| Before 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.
| 
| > how can i call it to view on a web page [...]?
| 
| 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.

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
Bynary field?Jose Albert12 Aug
  • Re: Bynary field?Martin Ramsch12 Aug