1. Go to this page and download the library: Download melonsmasher/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/ */
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 vendor:publish --provider="Axn\LaravelGlide\ServiceProvider"
sh
php artisan glide:key-generate
blade
<!-- From default server -->
<img src="{{ Glide::url('example1.jpg', ['w' => 500, 'h' => 300, 'fit' => 'crop']) }}">
<!-- From "avatars" server -->
<img src="{{ Glide::server('avatars')->url('example2.jpg', ['w' => 250, 'fit' => 'fill']) }}">
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.