CImage and img.php

CImage and img.php enables server-side image processing utilizing caching and optimization of the images.

#About

CImage is a collection of PHP classes enabling resizing, scaling and cropping of images. You can process the image and apply effects through filters and post processing utilities.

The script img.php is the front-end that takes URL-parameters from the querystring, load a default configuration and then uses CImage to carry out the actual image processing.

#Example

This is how it could work.

img.php?src=kodim23.png&width=600&height=200&crop-to-fit

or with pretty urls.

images/kodim23.png?width=600&height=200&crop-to-fit

#Get going quick and dirty

This is a quick and dirty way to get going.

We want a structure like this.

../cache 

.
├── img
│   └── kodim23.png
└── imgd.php

Get the img.php in an all-included-bundle together with a test image and create the cache directory.

wget https://raw.githubusercontent.com/mosbth/cimage/master/webroot/imgd.php
wget https://raw.githubusercontent.com/mosbth/cimage/master/webroot/img/kodim23.png
mkdir ../cache && chmod 777 ../cache

You can now open up your browser and reach the imgd.php and add the querystring ?src=kodim23.png&width=200. You should get a image like this.

And now you should really start to read the documentation, really.

#Learn more

Move on to read the documentation.