PHP code example of vis / laravel-glide

1. Go to this page and download the library: Download vis/laravel-glide 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/ */

    

vis / laravel-glide example snippets



// Laravel 4: app/config/app.php

'providers' => [
    ...
    'Spatie\Glide\GlideServiceProvider',
    ...
];


// Laravel 4: app/config/app.php

'aliases' => [
	...
    'GlideImage' => 'Spatie\Glide\GlideImageFacade',
    ...
]


return [
    /*
     * Glide will search for images in this directory
     *
     */
    'source' => [
        'path' => storage_path('images'),
    ],

    /*
     * The directory Glide will use to store it's cache
     * A .gitignore file will be automatically placed in this directory
     * so you don't accidentally end up committing these images
     *
     */
    'cache' => [
        'path' => storage_path('glide-cache'),
    ],

    /*
     * URLs to generated images will start with this string
     *
     */
    'baseURL' => 'img',

    /*
     * The maximum allowed total image size in pixels
     */
    'maxSize' => 2000 * 2000
];


<img src="{{ GlideImage::load('kayaks.jpg')->modify(['w'=> 50, 'filt'=>'greyscale']) }}" />

<img src="{{ GlideImage::load('kayaks.jpg', ['w'=> 50, 'filt'=>'greyscale']) }}" />

GlideImage::load('kayaks.jpg')
	->modify(['w'=> 50, 'filt'=>'greyscale'])
	->save($pathToWhereToSaveTheImage);
bash
php artisan config:publish spatie/laravel-glide