PHP code example of everywell / imagination

1. Go to this page and download the library: Download everywell/imagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

everywell / imagination example snippets


'providers' => [
    
    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...
    
    /**
     * Third Party Service Providers...
     */
    EveryWell\Imagination\ImaginationServiceProvider::class,

],

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

class News extends Model implements HasImagesContract
{
    use HasImages;

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
                ]
            ]
        ]
    ];