Download the PHP package emiliolodigiani/laravel-images without Composer
On this page you can find all versions of the php package emiliolodigiani/laravel-images. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download emiliolodigiani/laravel-images
More information about emiliolodigiani/laravel-images
Files in emiliolodigiani/laravel-images
Package laravel-images
Short Description Responsive image resizing with srcset generation for Laravel
License MIT
Informations about the package laravel-images
Laravel Images
Responsive image resizing with srcset generation for Laravel.
Automatically resizes images to multiple WebP variants and generates <img> tags with srcset for optimal loading. Configurable image sources allow each project to define its own directories and URL structure.
Installation
Publish the config file:
Configuration
Define your image sources in config/images.php:
Each source defines:
- originals — absolute path to the directory with original images
- originals_url — public URL prefix for originals (used as fallback when no resized versions exist)
- sizes — absolute path where resized versions are stored (subdirectories per width)
- url — public URL pattern for srcset (
{width}is replaced with the actual value)
Usage
Blade component
The component outputs an <img> tag with srcset and sizes attributes. If no resized versions exist, it falls back to the original.
HTML body helper
For rich text content with embedded <img> tags:
This transforms all <img> tags in the HTML to responsive versions with srcset, sizes, and loading="lazy".
Resize after upload
The package does not handle file storage — your app saves files using Laravel's filesystem (Storage, Livewire storeAs(), controller store(), etc.). After saving, call ImageResizer::resize() with the absolute path to generate all resized versions.
The resize() method automatically detects which configured source the file belongs to based on its path.
Deleting images
Use ImageResizer::delete() to remove an image and all its resized versions:
Batch resize
Generate missing resized versions for all configured sources:
Programmatic access
How it works
- When an image is resized, WebP versions are generated for each configured width that is smaller than the original
- Images are scaled by their longer side (portrait images scale by height, not width)
- A PHP manifest file at
storage/framework/image-sizes.phptracks which sizes exist for fast lookup (no database queries) - The manifest is automatically updated after each resize operation and OPcache-invalidated for zero-downtime deploys
Customizing the view
Publish the Blade view to customize the <img> output:
The view will be at resources/views/vendor/laravel-images/components/img.blade.php.
Requirements
- PHP 8.2+
- Laravel 11 or 12
- Intervention Image 3 (GD driver)
License
MIT
All versions of laravel-images with dependencies
illuminate/support Version ^11.0|^12.0|^13.0
intervention/image Version ^3.0