Anahkiasen / illuminage by Anahkiasen

Wrapper for the Imagine library to hook into the Laravel framework
4,249
18
5
Package Data
Maintainer Username: Anahkiasen
Maintainer Contact: ehtnam6@gmail.com (Maxime Fabre)
Package Create Date: 2013-03-05
Package Last Update: 2015-08-06
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-22 15:05:25
Package Statistics
Total Downloads: 4,249
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 18
Total Watchers: 5
Total Forks: 4
Total Open Issues: 1

DEPRECATED: Use Glide instead

Illuminage

Build Status Latest Stable Version Total Downloads Scrutinizer Code Quality Code Coverage

Setup

First do composer require anahkiasen/illuminage:dev-master.

Then if you're on a Laravel app, add the following to the providers array in app/config/app.php :

'Illuminage\IlluminageServiceProvider',

And this in the facades array in the same file :

'Illuminage' => 'Illuminage\Facades\Illuminage',

And then do artisan asset:publish anahkiasen/illuminage.

Usage

Illuminage is a wrapper for the Imagine library to hook into the Laravel framework. It implements elegant shortcuts around Imagine and a smart cache system.

// This will create a cropped 200x300 thumb, cache it, and display it in an image tag
echo Illuminage::thumb('image.jpg', 200, 300)
// or
echo Illuminage::image('image.jpg')->thumbnail(200, 300)

// Shortcuts
echo Illuminage::square('image.jpg', 300)

What you get from those calls are not direct HTML strings but objects implementing the HtmlObject\Tag abstract, so you can use all sorts of HTML manipulation methods on them :

$thumb = Illuminage::square('image.jpg', 200)->addClass('image-wide');
$thumb = $thumb->wrapWith('figure')->id('avatar');

echo $thumb;
// <figure id="avatar"><img class="image-wide" src="pathToThumbnail.jpg"></figure>

You can at all time access the original Imagine instance used to render the images :

$thumb = Illuminage::image('foo.jpg')->thumbnail(200, 200);

echo $thumb->grayscale()->onImage(function($image) {
  $image->flipVertically()->rotate(45);
});