• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

SQL: How do I store a jpg/gif/pic file into a SQL table?

I guess the only way to do it for now, would be by the name of the file?
I mean it will treat it just like any .txt file.
You can not sort by " whats in the picture" yet....
 
In mysql, use the BLOB type, like oog mentioned. This is usually a bad way to do it though, you can't do any logical operations on the image contents, you're better off storing the file path in the database.
 
If you are going to store the binary data in a blob field, make sure you store other attributes of the file as well. Like the extension or datatype. You won't be able to figure out later if it's a JPEG, GIF or PIC image file from reading the blob field alone.
 
Hi! I was just working on this problem. In MySQL, you can definitely just use the BLOB type but there's a 500k limit on it I think. In general, it's more practical to store just the filename and other properties (i.e. filesize, description, etc) into the database.

I just figured out how to do this with PHP/MySQL so if you need any help with this, just ask.

Good Luck,
Aaron
 
Originally posted by: ajromero
Hi! I was just working on this problem. In MySQL, you can definitely just use the BLOB type but there's a 500k limit on it I think. In general, it's more practical to store just the filename and other properties (i.e. filesize, description, etc) into the database.

I just figured out how to do this with PHP/MySQL so if you need any help with this, just ask.

Good Luck,
Aaron

Who gave you this ridiculous idea that BLOB field in MySQL has a limit of 500K? With default installation, the limit is set to 1MB. But with MySQL version 3.x the max is 16MB. With the newer version 4.x the max is somewhere around 2GB.
 
Back
Top