Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

Best data type in mySQL for an Image

Guest
Dec 12, 2009 Dec 12, 2009

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

13.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 12, 2009 Dec 12, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 12, 2009 Dec 12, 2009

Hi Bogdan,

I was eying MEDIUMBLOB as the data type.

BLOB values are treated as binary        strings (byte strings) in mySQL and

I just wanted to know if BLOB is in principle the best container for

a jpeg image in mySQL.

Scott

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 15, 2010 Jul 15, 2010

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 15, 2010 Jul 15, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 15, 2010 Jul 15, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 21, 2010 Jul 21, 2010
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines