Welcome Guest, Not a member yet? Register   Sign In
Handling different assets images, video, pdf, docs, etc on the back-end[Solved]
#1

[eluser]Otemu[/eluser]
Hi,

Just wondered how people were handling different assets within there site on the back-end and what structure was being used, when storing the path to each asset in a database after upload. Typically a site will have common set of images used and various assets, video, docs, etc.

Are you using one database table for all assets? (all image sizes, videos, pdf, docs etc)
Separate database tables for each asset?
or some other method?

When uploading do you have predefined folders images, pdf, docs?
Manually defined structure to create locations/folders on the back-end?
Using some kind of tree structure?

Since I need to build such a system any tips, links or methods be great?

Thanks
#2

[eluser]CroNiX[/eluser]
I use a database-based config system (basically same as CI config, except it uses the database so it's easily editable by the customer) where I (or the site owner) can enter the paths for various assets, so paths are customizable.

Then there is an assets table that only stores the filename (no path), a category id for the asset type (which is how the path gets determined), a single field to store a serialized array of parameters for that asset (which differ from images/video/audio/pdf/etc so I don't have to use separate tables for each type), the id of the entity that the asset belongs to and the order that the asset gets displayed (like an image gallery might have a specified order to display the images). A few more common fields like mime-type, file size, etc.

There are predetermined sizes that things like images get turned into (small thumbnail, large thumbnail, actual image) and each one has the path in the db config along with the image dimensions each one gets resized to. Since this is for all images, we just store the main image data in the db and can determine which type to load based on its case use (gallery might get all small thumbnails which point to the large images). If we need a small thumbnail for an image, we just use the same data from the assets table (image filename) and use the appropriate path when displaying that particular image (small thumbnail dir).

Each project has different requirements, of course, but I use this system, or a variation of it, on several larger sites and it works a treat.

Hope some of the ideas are useful.
#3

[eluser]Otemu[/eluser]
Thanks for your reply CroNiX and well detailed answer. Your answer actually helps a lot, I did have some ideas on how to do it, however some of the things you said help make for a more efficient process and I definitely be taking a few if not all of your ideas on-board.

Thanks Again




Theme © iAndrew 2016 - Forum software by © MyBB