Getting Started

Imanee is a simple wrapper to facilitate the use of ImageMagick and GD in PHP. Imanee provides several convenient methods for dealing with images, generating text and animated gifs, applying filters and funny effects to images, amongst other things.

Requirements

Imanee requires PHP >= 5.4 and a supported image extension to be installed and loaded in the PHP server. We currently support Imagick and GD. Imanee will always try to use Imagick by default, but if it cannot find the Imagick extension loaded, it will try to use GD instead. You can also override this behavior by providing a ImageResource object when instantiating Imanee.

Installation

Installation can be made easily through composer:

$ composer require imanee/imanee

Check the latest stable version on Packagist: imanee/imanee

Getting Started

A few simple examples to get you started

  1. Thumbnail output:
header("Content-type: image/jpg");

$imanee = new Imanee('path/to/my/image.jpg');
echo $imanee->thumbnail(200, 200)->output();
  1. Resizing an image:
header("Content-type: image/jpg");

$imanee = new Imanee('path/to/my/image.jpg');
echo $imanee->resize(200, 200)->output();
  1. Writing centralized text on top of an image:
header("Content-type: image/jpg");

$imanee = new Imanee('path/to/my/image.jpg');
echo $imanee->placeText('imanee test', Imanee::IM_POS_MID_CENTER)->output();
  1. Adding a translucid watermark:
header("Content-type: image/jpg");

$imanee = new Imanee('path/to/my/image.jpg');
echo $imanee->watermark('path/to/my/image.png', Imanee::IM_POS_BOTTOM_RIGHT, 50)->output();

5. Forcing use of GD: Sometimes it might be useful to force usage of a specific Image Resource type. You can just pass an object implementing the ImageResource interface as a second argument to the Imanee constructor.

header("Content-type: image/jpg");

$imanee = new Imanee('path/to/my/image.jpg', new GDResource());
echo $imanee->thumbnail(200, 200)->output();