Best data type in mySQL for an Image

Copy link to clipboard
Copied
What would be the preferred data type in mySQL to store an image
(jpeg or png)?
I would think BLOB would serve this purpose best.
Who is currently doing this and what data type are you using?
Regards,
Scott
Copy link to clipboard
Copied
Depends on your images sizes.
BLOB = 65KB
MEDIUMBLOB = 16MB.
LONGBLOB = 4GB.
I think you can use mediumblob, but you know best the maximum size of
a picture.

Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Scott
I wondered if you got this working, I am trying to use mysql to store images in and the retrieve but I can upload but am being unable to view in the browser I am just getting the raw data, have tried a proxy script am still not getting it working?

Copy link to clipboard
Copied
Hi GIlly,
well, we all agreed that the best field type in which to store the image
would me a blob. I still have not succeeded in storing an actual image
in MySQL database (see my post of July 4th).
UbuntuPenguin has been giving me some ideas but I can't get
an image written to the DB. The trick is to encode the image into
a byteArray and I have code for that and for the decode of the
image when reading from the database.
If you take the encoded byteArray and copy it by hand into a blob
field in MySQL every thing is fine. I just can't get an HTTP service
call to do it.
Regards,
Scott
Copy link to clipboard
Copied
Hi Scott
I have literally this very moment cracked it!!
my posting on the forum is at
http://forums.adobe.com/message/2975781#2975781
it might help if you are still looking to do it.
Best wishes
Gilly

Copy link to clipboard
Copied
Hi GIlly,
thanks for taking the time to reply to this (old) post. The problem, of saving images to
MySQL is still hounding me.
I bought a package from the Flex Application Store to handle the MySQL interface
which works most of the time. So, unfortunately I am pretty ignorant of PHP and can't
fathom just what in your code solves the problem.
Regards,
Scott
