Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

esyede/imago

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imago

Simple, standalone GD image manipulation library written in PHP.

Requirements

  • PHP 5.4+
  • PHP GD extension

Installation

Download the file from release page and drop to your project. That's it.

Loading image

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 0 to 100.

Resize

Resize image width:

$imago->width(100); // 100 pixel

Resize image height:

$imago->height(100); // 100 pixel

Rotate

$imago->rotate(90); // rotate 90 degree

$imago->rotate(180); // rotate 180 degree

Note: This rotate() method will only accepts values multiplied by 90.

Crop

$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);

Effects

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 -100 to 100.

Sepia:

$imago->sepia();

Edge highlight:

$imago->edge();

Emboss:

$imago->emboss();

Sketch:

$imago->sketch();

Invert color:

$imago->invert();

Pixelate:

$imago->pixelate();

Preview & Exporting

Preview current result via web browser:

$imago->preview();

Exporting result into a file:

$imago->export('cat.png');

Additional Features

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!

License

This library is licensed under the MIT License

About

Imago is a simple, standalone GD image manipulation library written in PHP.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages