• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Managing multiple versions of assets

#1
[eluser]digitalbloke[/eluser]
Hi guys

I’d really appreciate some advice on managing assets for my latest project. I’ve planned something out, but I think it might get a bit complicated.

The short version of my question:
How do you manage / store multiple version of assets for a desktop and mobile site.

The long version of my question (with some background information):
I’m working on something that is very similar to a photo gallery. I have multiple categories, projects and images / videos. I’m currently storing them in relational tables called: categories, projects and slides. I’ve called the last table slides rather than images, as it may be a video rather than an image.

Thats all fine and dandy, but where I’m getting into a bit of a tangle is that I need to keep multiple sizes of each slide. Right now I need to have assets for a desktop and a mobile version of the site. And the desktop version has a high and a low resolution version of the videos.

My current file structure is like so:
[Image: files.png]
The numbers in the image and video files are from the insert id from mysql.

Images are not too much of problem, but the videos get rather complicated, and its only going to get worse when I start introducing theora files for html5.

My slides table looks something like:

‘id’ - Auto integer
‘title’ - Varchar
‘description’ - Text
‘type’ - Enum (‘image’, ‘video’)

I have the type field so I know when to include a video in my HTML markup.

I don’t store the full path to the images in the database as if anyone renames a category or a project, the respective folder gets renamed too. This means that I obviously have to preform a 3 table join to build the url for the image.

Code may not be spot on. I've not tested it.
Code:
$this->db->select(‘categories.name AS c_name, projects.name AS p_name, slides.*);
$this->db->join(‘projects’, ‘projects.id = slides.project_id’, ‘left’);
$this->db->join(‘categories’, ‘categories.id = projects.category_id’, ‘left’);

Then, for example, if I want the mobile version of an image i can use something along the following lines (I’ll probably make a helper for this):

Code:
$path = APPPATH . “upload/{$slide->c_name}/{$slide->p_name}/{$slide->id}_mobile.jpg”;

Finally, just for fun (or not as the case may be) I’ll need to add a tablet version of the site in a few months, so you guessed it, another set of images and videos. Hence I’m trying to find the best way to store them from the start.

If you have any suggestions I’d love to hear them. I’m more than happy to chuck out all of the above if you have something better, or if you can suggest any tweaks that would be awesome also!

If you’ve made it this far, thanks for sticking with me!

#2
[eluser][254]Prof[/eluser]
I think the simplest way would be to have different tables for each, e.g. for desktop, for mobile etc


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.