dev-master
9999999-dev https://github.com/abhimanyusharma003/ImageMagicImage handling
MIT
The Requires
- php >=5.3.0
by Abhimanyu Sharma
image imagick
Image handling
Image Magic is based on PHP:Imagick library. The main use of this library to provide caching and easy image manipulation., (*1)
Using methods chaining, you can open, transform and save a file in a single line:, (*2)
<?php require_once('ImageMagic.php'); use abhimanyusharma003\Image\Image; Image::open('in.png') ->resizeImage(100, 100) ->save('out.jpg');
The methods available are:, (*3)
cropImage($width, $height, $x = null, $y = null)
: crop the image to given dimension, (*4)
cropThumbnailImage($width, $height)
: Creates a fixed size thumbnail by first scaling the image up or down and cropping a specified area from the center., (*5)
resizeImage($width, $height)
: resizes the image, will orce the image to
be exactly $width by $height, (*6)
enlargeSafeResize($width, $height)
: resizes the image keep aspect ratio, will never enlarge the image nor canvas., (*7)
You save the image with save($imageName,$format,$qualit)
method., (*8)
<?php use abhimanyusharma003\Image\Image; Image::open('in.png')->save('out.jpg','jpg',100);
Each operation above is not actually applied on the opened image, but added in an operations
array. This operation array, the name, type and modification time of file are hashed using
sha1()
and the hash is used to look up for a cache file., (*9)
If cache file already present no operation will be executed, (*10)
Image::open('in.png')->resizeImage(200,200)->jpeg();
This will re-size you image on the fly, (*11)
This repository is available with composer under the name abhimanyusharma003/image
, so simply add this to
your requires :, (*12)
"requires": { ... "abhimanyusharma003/image": "dev-master" ... }
And update your dependencies, you'll be able to use the composer autoloader to load the class, (*13)
Most of the codes of this library are taken from https://github.com/Gregwar/Image class it's based on PHP GD library., (*14)
Do not hesitate to fork this repository and customize it!, (*15)
Image handling
MIT
image imagick