19 Feb 2010 | Resizing images on the fly using PHP

Geonews: news from a location on a particular date

I'm currently working on the new Twaweza website (not online as I write this), and needed a library to resize images on the fly with PHP, without having to store the resized images.

Being a typical lazy coder, I looked around for an existing library and found a useful start in Simon Jarvis' library for resizing images on the fly. It almost served my needs, besides the ability to resize images to fit inside a user defined box.
So I added the function resizeToMax.

The updated file can be found in my dropbox. Obviously, change the extension to php to use it.

Update (March 2010): I also included a resizeToMin function which resizes an image so that it fits over the passed box size. This is the same as what Flickr uses for their square thumbnails.

Tagged with: Flickr image PHP resizing thumbnails

Geonews: news from a location on a particular date

About

  • Me

After obtaining an M. Sc in maths, Babak Fakhamzadeh started with an office job at a major blue chip company but soon realised he'd do better on his own. Babak is a traveling web guru with a penchant for doing good and a love for visual and experimental art. Together with Eduardo Cachucho, he won the World Summit Award in the m-Tourism and Culture category in 2012 for Dérive app. With Ismail Farouk, he won the Highway Africa new media award in 2007 for Soweto Uprisings . com. Check out Babak's CV.

Contact

Babak is currently in Brasil.
+55 219 6557 5388 (Brasil)

September/October 2014

23
24
25
26
27
28
29
30
01
02
03
04
05
06
07
08
09
10
11
12
13
14
17
18
19
21
22
23
24
25
26