Download & Install
There are mainly two ways of using CImage. You either install the whole project which uses the autoloader to include needed files, or you install the all-included bundle that – for convenience and ease of use – contains all code in one script.
You can download CImage from GitHub or by using composer.
If this is your first time then I would recommend downloading the whole repo from GitHub. That is the fastest and easiest way of getting up and running for the first time.
#GitHub
The source code is available on GitHub. Clone, fork or download as zip.
You can clone it like this.
git clone git://github.com/mosbth/cimage.git
cd cimage
Ensure that the cache-directory is writable by the webserver.
chmod 777 cache
Point your web browser to webroot/test/test.php
to see some examples.
Then try on your own by using the script img.php
. Try the following url:
webroot/img.php?src=kodim04.png&w=200
It should display the same image as to above right.
#Composer
The package mos/cimage
is available on Packagist and you can install it using composer.
composer require mos/cimage
You can now copy the all-included bundles from the webroot
directory and put them in your own web root directory, or you copy img.php
together with its config file img_config.php
and you put it in your own web root.
#All-included bundle
There exists pre-configured variants of the all-included bundles of img.php
. These can be downloaded as a single PHP script and used without dependency to the rest of the source code.
Bundled script | Description |
---|---|
imgd.php |
Development mode |
imgp.php |
Production mode |
imgs.php |
Strict mode |
Download the bundle of your choice from the links above or by using wget or curl like this.
wget https://raw.githubusercontent.com/mosbth/cimage/master/webroot/imgd.php curl -O https://raw.githubusercontent.com/mosbth/cimage/master/webroot/imgd.php