explaingit

intervention/image

14,336PHPAudience · developerComplexity · 2/5LicenseSetup · moderate

TLDR

PHP library for resizing, watermarking, and converting images in web applications, switch between GD, Imagick, or libvips with one line of config.

Mindmap

mindmap
  root((Intervention Image))
    What it does
      Resize images
      Convert formats
      Add watermarks
    Drivers
      GD built-in
      Imagick
      libvips fast
    Use Cases
      Photo uploads
      Format conversion
      Batch processing
    Setup
      Composer install
      PHP 8.3 required
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Automatically resize and compress user-uploaded photos in a PHP web app.

USE CASE 2

Convert images between formats such as PNG to WebP in a few lines of PHP code.

USE CASE 3

Add watermarks to images before serving them from your website.

USE CASE 4

Handle animated image processing on any PHP server regardless of which image extension is installed.

Tech stack

PHPGDImagicklibvipsComposer

Getting it running

Difficulty · moderate Time to first run · 30min

Requires PHP 8.3+ and one of GD, Imagick, or libvips installed on the server.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Intervention Image is a PHP library for reading, editing, and saving images on a web server. PHP is one of the most common programming languages for building websites, and this library gives PHP applications a straightforward way to handle image processing tasks without writing complex low-level code. The library can resize images, insert watermarks, change formats, and adjust quality. A developer writing PHP code for a website that lets users upload photos, for example, could use Intervention Image to automatically resize those photos, compress them to a smaller file size, or convert them from one format to another, all in a few lines of code. One practical feature is that the library does not depend on a single underlying image processing engine. PHP environments can have different tools installed for handling images: GD is a basic library that comes built into PHP by default, Imagick is a more capable extension based on ImageMagick, and libvips is a high-performance option for large or complex workloads. Intervention Image supports all three and lets you switch between them by changing one line of configuration. This means the same code can run on servers with different setups without modification. The library also supports animated images across all three drivers. Installation is done through Composer, which is the standard PHP package manager. The library requires PHP version 8.3 or newer and one of the three supported image processing extensions. It works with any PHP framework or without one. It is released under the MIT license and is free to use in both personal and commercial projects.

Copy-paste prompts

Prompt 1
Using Intervention Image in PHP, resize every uploaded image to 800px wide, convert it to WebP, and save it to disk.
Prompt 2
Show me how to add a text watermark to a user-uploaded photo using Intervention Image with the GD driver.
Prompt 3
Write a PHP script that uses Intervention Image to batch-convert a folder of JPEG files to compressed WebP.
Prompt 4
How do I switch Intervention Image from the GD driver to Imagick in my Laravel application?
Open on GitHub → Explain another repo

← intervention on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.