1. Go to this page and download the library: Download sandstorm/laravel-imagor 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/ */
sandstorm / laravel-imagor example snippets
// Generate URL using helper function
$url = imagor()
->resize(width: 400, height: 300)
->uriFor('https://example.com/image.jpg');
$imagor = imagor();
// ❌ WILL NOT WORK ❌ because a new object is returned
$imagor->resize(width: 400, height: 300);
$imagor->uriFor('https://example.com/image.jpg');
// ✅ Instead, do the following:
$imagor = $imagor->resize(width: 400, height: 300);
$imagor->uriFor('https://example.com/image.jpg');
FileUpload::make('media_files')
->acceptedFileTypes(['image/*'])
->rules(['image', 'max:10240']) // max 10MB per file
->disk('public')
->visibility('public')
use Sandstorm\LaravelImagor\Filament\Components\ImagorFileUpload;
ImagorFileUpload::make('media_files')
->acceptedFileTypes(['image/*'])
->rules(['image', 'max:10240']) // max 10MB per file
// not me logic, different syntax (without global function)
->imageProcessor(fn(ImagorPathBuilder $imagor) => $imagor->resize(100)),
// In AppServiceProvider::boot()
use Illuminate\Support\Facades\Blade;
Blade::directive('imagorWide', function ($expression) {
return " echo imagor()->resize(width: 400)->uriFor($expression);