Git Product home page Git Product logo

illuminage's Introduction

Illuminage

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)

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

// This will resize image to specified dimensions, cache it, and display it in an image tag
echo Illuminage::resize('image.jpg', 200, 300)

// This will **proportionaly** resize image to fit the specified dimensions, cache it, and display it in an image tag
echo Illuminage::fit('image.jpg', 200, 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>

To get the URL of generated image:

echo $thumb->getPath();

You can at all time access the Image instance used to render the images and use the Imagine methods:

$thumb = Illuminage::image('foo.jpg');

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

Installation

  • Add "anahkiasen/illuminage":"dev-master" in "require" section of composer.json
    • To use this version of Illuminage (with fit support), add:
     "repositories":[
         {
             "type":"git",
             "url":"https://github.com/terion-name/illuminage"
         }
     ],
    
  • Run command composer update
  • Add 'Illuminage\IlluminageServiceProvider' in providers list in config/app.php
  • Add 'Illuminage' => 'Illuminage\Facades\Illuminage' in aliases list in config/app.php
  • Run commands php artisan asset:publish and php artisan config:publish anahkiasen/illuminage

illuminage's People

Contributors

anahkiasen avatar terion-name avatar yaapis avatar arthurdarcet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.