2017 © Pedro Peláez
 

library imagination

A Laravel package that allows to handle images on your models seamlessly

image

everywell/imagination

A Laravel package that allows to handle images on your models seamlessly

  • Friday, January 5, 2018
  • by EveryWell
  • Repository
  • 1 Watchers
  • 1 Stars
  • 399 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 16 % Grown

The README.md

Imagination

A Laravel package that allows to handle images on your Eloquent models seamlessly., (*1)

Installation

To install this package just a few steps are needed, (*2)

Composer

Pull this package in through Composer using the following command inside your terminal:, (*3)

composer require everywell/imagination

Service Provider

Add the package to your application service providers in config/app.php file., (*4)

'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...

    /**
     * Third Party Service Providers...
     */
    EveryWell\Imagination\ImaginationServiceProvider::class,

],

Config File

Publish the package config file to your aplication running the following command inside your terminal:, (*5)

php artisan vendor:publish --provider="EveryWell\Imagination\ImaginationServiceProvider"

Trait and Contract

Include HasImages trait and also implement HasImages contract inside your model class., (*6)

use EveryWell\Imagination\Traits\HasImages;
use EveryWell\Imagination\Contracts\HasImages as HasImagesContract;

class News extends Model implements HasImagesContract
{
    use HasImages;

Images attribute

Add an images array attribute to your model containing the fields that should be handled as images., (*7)

use EveryWell\Imagination\Traits\HasImages;
use EveryWell\Imagination\Contracts\HasImages as HasImagesContract;

class News extends Model implements HasImagesContract
{
    use HasImages;

    protected $fillable = [
        'title',
        'text',
        'banner',
        'image'
    ];

    protected $images = [
        'banner',
        'image' => [
            'discard_original' => true, // Optional: if true, doesn't save the original version of the image
            'dimensions' => [           // Optional: specifies different dimensions than the default config
                [
                    'name' => 'thumb',
                    'width' => 150
                ],
                [
                    'name' => 'small',
                    'width' => 250
                ],
                [
                    'name' => 'regular',
                    'width' => 600
                ]
            ]
        ]
    ];

And that's it!, (*8)

The Versions

05/01 2018

dev-develop

dev-develop

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

MIT

The Requires

 

by Andrea Ognibene

laravel cache models images

05/01 2018

dev-master

9999999-dev

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

MIT

The Requires

 

by Andrea Ognibene

laravel cache models images

05/01 2018

1.0.3

1.0.3.0

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

MIT

The Requires

 

by Andrea Ognibene

laravel cache models images

04/01 2018

1.0.2

1.0.2.0

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

MIT

The Requires

 

by Andrea Ognibene

laravel cache models images

04/01 2018

dev-feature/job_schedule

dev-feature/job_schedule

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

MIT

The Requires

 

by Andrea Ognibene

laravel cache models images

23/08 2017

v1.0.1

1.0.1.0

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

MIT

The Requires

 

by Andrea Ognibene

laravel cache models images

22/08 2017

v1.0.0

1.0.0.0

A Laravel package that allows to handle images on your models seamlessly

  Sources   Download

GPL

The Requires

 

by Andrea Ognibene

laravel cache models images