Simple, standalone GD image manipulation library written in PHP.
- PHP 5.4+
- PHP GD extension
Download the file from release page and drop to your project. That's it.
require 'Imago.php';
use Esyede\Imago;
$imago = Imago::open('myimage.jpg')You can also set the export quality while loading the image:
$imago = Imago::open('test.jpg', 75);Note: Accepted range is between
0to100.
Resize image width:
$imago->width(100); // 100 pixelResize image height:
$imago->height(100); // 100 pixel$imago->rotate(90); // rotate 90 degree
$imago->rotate(180); // rotate 180 degreeNote: This
rotate()method will only accepts values multiplied by 90.
$left = 50;
$top = 20;
$width = 100;
$height = 100;
$imago->crop($left, $top, $width, $height);You may also use ratio-based cropping:
$width = 2;
$height = 1;
$imago->ratio($width, $height);Brightness:
$imago->brightness(40);Contrast:
$imago->contrast(80);Smoothness:
$imago->smoothness(80);Gaussian blur:
$imago->blur();Selective blur:
$imago->blur(true);Grayscale:
$imago->grayscale(35);Note: Accepted range is between
-100to100.
Sepia:
$imago->sepia();Edge highlight:
$imago->edge();Emboss:
$imago->emboss();Sketch:
$imago->sketch();Invert color:
$imago->invert();Pixelate:
$imago->pixelate();Preview current result via web browser:
$imago->preview();Exporting result into a file:
$imago->export('cat.png');Read image info:
$imago->info();Make an identicon image:
// Make an identicon with default size (64 pixel)
$identicon = Imago::identicon('john.doe@gmail.com');
// Make an identicon with custom size
$identicon = Imago::identicon('john.doe@gmail.com', 200);
// Preview identicon via web browser
return Imago::identicon('john.doe@gmail.com', 64, true);
// Export identicon into a file
file_put_contents('user.jpg', $identicon, LOCK_EX);That's pretty much it. Thank you for stopping by!
This library is licensed under the MIT License