Skip to content

How do I handle images and thumbnails

Derek Jones edited this page Jul 5, 2012 · 11 revisions

Category:Approaches

The Goal

You need to deal with images - perhaps uploaded by users, or pulled in from another system. You are likely going to have to cater for multiple versions - thumbs, large, perhaps even raw or 'original' size. You are almost definitely working with a database.

Discussion

There are three places you can store your images:

  1. within the database (the 'blob'),
  2. within the file system, or
  3. hosted on another site and included in your pages.

And there are two ways your app can respond to different image size requests:

  1. prepare all images up front and store them in the file system, or
  2. create them on the fly (on demand).

The approaches

o How do I handle images and thumbnails - jedd - (summary - store images in file system, using UUID's), o How do I handle images and thumbnails - dcheslow - (summary - I too store images in the file system using UUIDs, I use UUIDs as primary keys so it's easy to associate images with DB records (and clean up when records are deleted), I wrote an image caching library that creates new sizes on demand and stores them in a cache, it checks timestamps and regenerates when needed. If there are no changes, then the cached file is returned. Best of both worlds! o {Your CI login-name goes here}'s take - summary of your approach goes here - COPY-THIS-LINE-WHEN-ADDING-YOURS

Note to would-be contributors - it'd be just fantastic if you'd spend the time sharing your approaches with the world, but please resist the temptation to provide a link to another site. First, sites come and go, and dead links are a real pain in the proverbial. Second, off-site material doesn't get discovered by searches within the wiki. Third, the world has enough web pages that are 'lists of links' - we don't need to add to the collection. And finally - the whole idea of this collection of Approaches is so that users can see what you do - so can you please put your name on anything you contribute, so people can PM you if they want to clarify something?

Need to automatically insert category/subcategory listing here somehow, later - for the moment I'll handcode in the first couple of links

Clone this wiki locally