MyBB Community Forums

Full Version: Uploading image to database [BLOB]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
First of all not 100% sure this should be posted in this forum, if its the wrong forum for it sorry (and maybe a mod can move it then).

Anyways i have a question is there a way to create an image uploader (that like the name suggests only allows images (jpg,gif,png etc.) ) to upload to a mysql table and store the files in a BLOB (binary large object)?

I a few days back started to work on making a gallery, using PHP and quickly found a way to store those in a mysql table.
A thing i noticed was that the files uploaded there were not counted towards the amount of files (only 1 file for the table itself). And seeing how currently attachments take up 2 for each which is in my opinion a bit of a waste.

I thought maybe there is a way to create an image uploader similar to how the attachment thing works now. But then simply uploading them to a database.

The question why im asking this is since i want to prevent a large amount of files on the server while still allowing the user to upload images.
Something they cant do right now since i dont allow them to add attachments.

Also for me this would make writing this gallery rather easy.
I could simply in one of the forums enable the image uploader. Use a bit of php code in the gallery.php and simply create a gallery automatically. Without having users need a special password or anything.

Anyways any help would be appreciated or feedback if this is a good or bad idea.
I did search for the effects of creating such a database: Comparing storing image files and database storing
(Yes i know the article is rather old)
And since i dont even expect to get over 200 images. I dont think it would become a to big of a problem.

Edit
Since this was moved to the plugin/code modification. I want to make clear this is NOT for a plugin. This is purely for the code required.