PHP code example of unrulynatives / laravel-glider
1. Go to this page and download the library: Download unrulynatives/laravel-glider 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/ */
unrulynatives / laravel-glider example snippets
use Daikazu\LaravelGlider\Facades\Glide;
// Generate URL
$url = Glide::url('photo.jpg', ['w' => 400, 'q' => 85]);
'presets' => [
'thumbnail' => ['w' => 150, 'h' => 150, 'fit' => 'crop'],
'hero' => ['w' => 1200, 'h' => 600, 'fit' => 'crop', 'q' => 90],
],
'background_presets' => [
'hero' => [
'xs' => ['w' => 768, 'h' => 400, 'fit' => 'crop'],
'md' => ['w' => 1024, 'h' => 500, 'fit' => 'crop'],
'lg' => ['w' => 1440, 'h' => 600, 'fit' => 'crop'],
],
],
return [
'source' => resource_path('assets'),
'cache' => storage_path('app/glider-cache'),
'base_url' => 'img',
'max_image_size' => 2000 * 2000,
'driver' => 'imagick', // or 'gd'
'defaults' => ['fm' => 'webp', 'q' => 85],
'presets' => [
'thumbnail' => ['w' => 150, 'h' => 150, 'fit' => 'crop'],
],
'background_presets' => [
'hero' => [
'xs' => ['w' => 768, 'h' => 400],
'lg' => ['w' => 1440, 'h' => 600],
],
],
];
// config/laravel-glider.php
'secure' => env('GLIDE_SECURE', true),
// Ensure images are within intended directories
'source' => resource_path('assets/images'),
// config/laravel-glider.php
'max_image_size' => 2000 * 2000, // Prevent memory exhaustion
bash
php artisan vendor:publish --tag="glider-config"
bash
php artisan glider:clear-cache
❌ ../../../etc/passwd
❌ /var/www/../../etc/shadow
❌ image.jpg%00.php
❌ symlink-to-sensitive-dir/file.jpg