Codeigniter.tvbeta

Codeigniter video tutorials and screencasts

Create multiple aspect ratio thumbnails

An advanced Codeigniter image library extension

Author: Joost van Veen

2011/09/09 Create multiple thumbs

Wouldn't it be great if you could create a number of image thumbnails, all in different sizes and aspect ratios, nicely cropped from the center? We will create a library extension that does just that!

This library extension is great for image galleries, CMS-es and so on. In short: for all applications in which you need to be able to display an image in different sizes.

  • Do you need to show all images in a 16/9 ratio on your image gallery? No sweat!
  • Do you want an 800px and a 120px square thumb for your image gallery? No problema, amigo!
  • Do you wish to build your own Flickr clone, and do you need to store 7 thumbnail sizes, all in different aspect ratios? That'll cost you, I'll have to write a whole 12 lines of code!

As always you can download the source code, too.