I’m trying to figure out how to do this. Or if I should use the physical disk to store all my files.
I want to be able to save themes that I make for my site to my database (i’m using my own framework) I originally was making themes in placing them in their own folder and uploading them to a themes folder, but since then I have redone my site to let other people create accounts and let them make their own themes and save them for later use.
I’m now using SMARTY template engine so now I have 1 folder called tpl and in that folder I have a few template files.
markup.tpl
site.tpl
and css.php
and js.php
these I hope will load in the css/js from the database.
But my issue is that in the CSS file there could be references to 50 images, how can I save those images along with the CSS file?
I didn’t know what would be easier to manage, images uploaded to my server with some hashed filename or have the images saved onto the database. If the images are in the database would it be easier to manage and organize? What if a user deletes their account, I would need to hunt down all the theme files and delete them one by one, especially the images. I imagine if the files are on the server, then deleted the rows that link to their unique ID would be alot easier…
Anyways, I’m trying to find the best method that would have less stress on my server or make modifying themes files via my online editor simpler when saving.
Don’t forget there is a limit to the size of MySQL BLOB columns so files would need to be broken over multiple rows. I feel in general that seeing as though the file system was written to handle file operations it is the best place for files.
Databases are effective where you have text that you need to search or operate against. They are not as effective with binary files.