PHP code example of axn / laravel-glide

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

    

axn / laravel-glide example snippets


'disks' => [
    //...
    'images' => [
        'driver' => 'local',
        'root' => storage_path('app/images'),
    ],

    'avatars' => [
        'driver' => 'local',
        'root' => storage_path('app/images'),
    ],
    //...
],

// App/Http/routes.php

use App\Http\Controllers\GlideController;
use Illuminate\Support\Facades\Route;

Route::get(config('glide.servers.images.base_url').'/{path}', [GlideController::class, 'images'])
    ->name('images')
    ->where('path', '(.*)');

Route::get(config('glide.servers.avatars.base_url').'/{path}', [GlideController::class, 'avatars'])
    ->name('avatars')
    ->where('path', '(.*)');



namespace App\Http\Controllers;

use Glide;
use Illuminate\Http\Request;

class GlideController extends Controller
{
    public function images($path, Request $request)
    {
        return Glide::server('images')->imageResponse($path, $request->all());
    }

    public function avatars($path, Request $request)
    {
        return Glide::server('avatars')->imageResponse($path, $request->all());
    }
}
sh
php artisan glide:key-generate
sh
php artisan vendor:publish --tag="glide-config"