Laravel 13.20 cuts image-handling friction with new native wrapper
Overview

Laravel 13.20 introduces a major convenience for developers by adding first-party support for image processing. Historically, handling media uploads required juggling external dependencies, configuring raw drivers, and writing multi-step storage logic. While third-party options remain robust, this new native API brings image resizing, cropping, and format conversion directly into the core framework syntax, reducing boilerplate and unifying the developer experience.
Prerequisites
To make the most of this tutorial, you should understand:
- Basic routing and controller architecture in the Laravel framework.
- PHP file handling concepts.
- How to manage packages via Composer.
Key Libraries & Tools
- Laravel: The PHP web framework hosting the new first-party image manipulation features.
- Intervention Image: The underlying PHP library that Laravel uses as its core engine.
- Spatie Media Library: An advanced media-to-model binding package for complex collection management.
Code Walkthrough
Let us compare the traditional, multi-step approach with the new native syntax.
The Manual Route: Intervention Image
Previously, managing a thumbnail with raw Intervention Image required manual driver setup, file name generation, and explicit step-by-step encoding:
// Using Intervention Image directly
$manager = new ImageManager(new Driver());
$image = $manager->read($request->file('photo'));
$thumbnail = $image->scale(width: 300);
$encoded = $thumbnail->toWebp();
Storage::disk('public')->put('thumbnails/photo.webp', $encoded);
This works. However, it forces you to manage intermediate state variables and interface directly with driver specifics.
The Native Solution: Laravel 13.20
The new API simplifies this process by integrating image manipulations straight into the request and file upload flow:
// The streamlined Laravel way
$request->file('photo')
->storeProcessed('thumbnails', function ($image) {
$image->width(300)->format('webp');
});
This chained approach eliminates manual driver instantiation and works natively with Laravel's file storage layer.
Syntax Notes
The new helper methods chain directly onto the uploaded file instance. Behind the scenes, Laravel resolves the active image driver configuration (like GD or Imagick), processes the closure, and saves the file in one unified transaction. It acts as a clean, fluent wrapper.
Practical Examples
Use the native API for:
- Creating instant
.webpthumbnails during user profile uploads. - Standardizing incoming catalog photographs to uniform dimensions.
- Stripping metadata to optimize storage efficiency on simple blogs.
Tips & Gotchas
Remember that this native tool does not replace Spatie Media Library. While Laravel handles the physical file conversion, it does not manage database relations, multiple collections, or polymorphic model links. Furthermore, you must still run composer require intervention/image in your project, as Laravel relies on it under the hood.
- Intervention Image
- 20%· products
- Laravel
- 20%· products
- Spatie Media Library
- 20%· products
- Nuno Maduro
- 10%· people
- Pest
- 10%· products
- Other topics
- 20%

NEW in Laravel 13.20: Image Manipulation
WatchLaravel Daily // 10:35