image README

The project's README from github.com/Intervention/image. As one markdown file: README.md.

Intervention Image

PHP Image Processing

Latest Version Build Status Monthly Downloads Support me on Ko-fi

Intervention Image is a PHP image processing library that provides a simple and expressive way to create, edit, and compose images. It comes with a universal interface for the popular PHP image manipulation extensions. You can choose between the GD library, Imagick or libvips as the base layer for all operations.

Installation

Install this library using Composer. Add the package with the following command:

composer require intervention/image

Getting Started

Learn the basics on how to use Intervention Image and more with the official documentation.

Code Examples

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
use Intervention\Image\Alignment;
use Intervention\Image\Color;
use Intervention\Image\Format;

// create image manager instance using the preferred driver
$manager = ImageManager::usingDriver(GdDriver::class);

// read image data from path
$image = $manager->decodePath('images/example.webp');

// scale image by height
$image->scale(height: 300);

// insert a watermark
$image->insert('images/watermark.png', alignment: Alignment::BOTTOM_RIGHT);

// encode edited image
$encoded = $image->encodeUsingFormat(Format::JPEG, quality: 65);

// save encoded image
$encoded->save('images/example.jpg');

Requirements

Ensure that your server environment meets the following requirements before installation:

Supported Image Libraries

Depending on your environment Intervention Image lets you choose between different image processing extensions.

Security

If you discover any security related issues, please email [email protected] directly.

Authors

This library is developed and maintained by Oliver Vogel

Thanks to the community of contributors who have helped to improve this project.

License

Intervention Image is licensed under the MIT License.

image (Intervention/image)

Searching Database…

14.4K ·GitHub
这是什么?Intervention Image 是一个用于处理图像的 PHP 库,可以创建、编辑和合成图像,并提供流畅、易读的 API。
它是独立应用,还是我可以加到项目里的库?它是一个 PHP 库,通过 Composer 安装,然后在你自己的代码中调用。它与框架无关,因此可用于任何 PHP 项目。
我该怎么把它加到项目里?用 Composer 安装,把该包添加到你的项目中即可。
使用前需要先安装什么?需要 PHP 8.3 或更高版本、Mbstring 扩展,以及至少一个图像处理扩展:GD、Imagick 或 libvips。
我该选哪个图像处理后端:GD、Imagick 还是 libvips?只要你的环境中可用,选哪个都可以。该库提供统一接口,因此无论你选择哪个驱动(GD、Imagick 或 libvips),你的代码都保持不变。
它支持 GIF 之类的动图吗?支持。三种驱动(GD、Imagick 和 libvips)都支持动图。
不改代码就能切换图像处理后端吗?可以。可互换的驱动架构让你在 GD、Imagick 和 libvips 之间切换时,仍能保持相同的流畅 API 调用。
Size
6.9 MB
Stars
14.4K
Age
13y
Commits · 90 Days