Pin Me

PHP Friendly Smart Image Resizer: A Handy Time Saving Script

written by: •edited by: Michele McDonough•updated: 1/16/2009
4

The PHP friendly Smart Image Resizer brought to you by Shifting Pixel is a handy wee script which allows you to resize images on the fly without having to use an application.

  • slide 1 of 5

    Resizing Images

    Anyone engaged in website design will inevitably run into problems with resizing images at some stage and it can be annoying and time consuming to use an art package in order to resize them. The PHP friendly Smart Image Resizer from Shifting Pixels is an extremely handy wee PHP script that takes all of the pain out of resizing your images. There is no need to modify the image or tweak any code and you only need to upload the image in high resolution once and then the script will take care of the rest. You can reuse the image as many times as you like at any size and wherever you want it.

  • slide 2 of 5

    Features

    Rating Average

    This is a major time saving device and it doesn’t just resize images it can also sharpen them, crop them based on height to width ratios and even color fill transparent PNGs and GIFs. The Smart Image Resizer will happily work with JPEGs, PNGs and GIFs. It also features built-in caching to keep image variations for optimal performance.

  • slide 3 of 5

    Ease of Use

    Rating Average

    In order to use the Smart Image Resizer you’ll need to have PHP 5.1 or above and you’ll need the GD library installed. You simply the download the file for free from Shifting Pixel unzip to your web server and create a writable directory called imagecache.

  • slide 4 of 5

    How To Use

    You can resize an image with the following code.

    <img src="/image.php/yourimage.jpg?width=200&amp;
    height=200&amp;image=/images/yourimage.jpg" alt="Your Image" />

    Or resize and crop it into a square like this.

    <img src="/image.php/yourimage.jpg?width=150&amp;
    height=150&amp;cropratio=1:1&amp;image=/images/yourimage.jpg" 
    alt="Your Image" />
  • slide 5 of 5

    Overall

    Rating Average

    So everything is handled from the src attribute of the img tag. Simple and easy and it could save you a fair bit of time. The Smart Image Resizer has been released under a Creative Commons Attribution Share Alike 3.0 United States license.

    If you work with PHP and currently waste a lot of time resizing your images and uploading alternative sizes then this script is definitely for you.