1

Topic: insert picture in the databse

How do i insert a picture in the database.
What should be the data type
Just like you have used it in the insertion of an avatar.
Thank you
regards francis

Re: insert picture in the databse

Moved to Programming
Avatars are not stored in the database. However, the correct datatype would be blob (in MySQL)

Re: insert picture in the databse

no real sense in storing images into a db.. and yeah its a BLOB (binary large object), either way you do it, it's going to take up hdd space.

~thegleek

Re: insert picture in the databse

Couldn't you use a string type too, and escape the binary data? dono what the limits on string types are in mysql though tongue

echo "deadram"; echo; fortune;

Re: insert picture in the databse

deadram wrote:

Couldn't you use a string type too, and escape the binary data? dono what the limits on string types are in mysql though tongue

why would you?

Re: insert picture in the databse

if you database was sqlite you might have to, I can't remember atm but i think there's only number and string data types. Also, as string, you could perform string based searches for the file type from the files header. Many file types have the first 2-4 bytes as chars specifying their format.

echo "deadram"; echo; fortune;

Re: insert picture in the databse

deadram wrote:

Also, as string, you could perform string based searches for the file type from the files header. Many file types have the first 2-4 bytes as chars specifying their format.

That sounds horrible tongue I would think it would be much more efficient to store than info in another field and search that.

Re: insert picture in the databse

Meh, i was just trying to think up excuses, to sound smart big_smile

either way though, files are the way to store files, not databases XD

echo "deadram"; echo; fortune;

Re: insert picture in the databse

deadram wrote:

Couldn't you use a string type too, and escape the binary data? dono what the limits on string types are in mysql though tongue

you mean a TEXT datatype? feh. not a good idea.

anyways, read all you want on TEXT -vs- BLOB here: http://dev.mysql.com/doc/refman/5.0/en/blob.html

~thegleek