IreIsaac / LaraImage by IreIsaac

Easily utilize the glide image package in laravel
22
0
0
Package Data
Maintainer Username: IreIsaac
Maintainer Contact: contact@isaacenderline.com (Isaac Enderline)
Package Create Date: 2016-02-03
Package Last Update: 2016-04-01
Language: PHP
License: MIT
Last Refreshed: 2024-12-14 15:03:02
Package Statistics
Total Downloads: 22
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 0
Total Forks: 1
Total Open Issues: 1

Laraimage

I am a fan of the php leagues Glide Image package and use it in most of my projects. This package will hopefully save someone else some time. Let me know if you handle integrating Glide into laravel differently.

Install

Via Composer

composer require ireisaac/laraimage
php artisan vendor:publish

Register service provider in config/app.php, at the end of the long providers array I'd check around line 155-160

    'providers' => [
        ...
        IreIsaac\LaraImage\ImageServiceProvider::class,
    ]

If you want to have access to an ever so handy facade register it in config/app.php

    'Image' => \IreIsaac\LaraImage\ImageFacade::class,

If you would like to use an artisan command to clear cached images generated by the application use the included command. in the file app/Console/Kernel.php add

    protected $commands = [
        ...
        IreIsaac\LaraImage\Commands\ClearImageCache::class,
    ];

To render a default image when a requested image does not exists, place an image named "ImageNotFound" in storage/app/images/default/, now you can add the following snippet to App\Exceptions\Handler@render and voila.

    if($e instanceof \League\Glide\Filesystem\FileNotFoundException) {

        return Image::outputImage(config('images.placeholder'), $request->all());
    }

Usage