The CodeIgniter (CI) framework is powerfull tool for rapid PHP application development. It has a lot of ready to use libraries and helpers. For example the Image Manipulation library resize function that lets you resize the original image, create a copy (with or without resizing), or create a thumbnail image. But, there is a minor problem when resize image with main ratio enabled. For example, if you want to resize an 256px x256px earth images below to 128px x 128px.