Expand description
Image handling and manipulation for Laravel Rust: a port of intervention/image-laravel and Intervention Image 4, with a pure-Rust driver built on the image crate.
ⓘ
use laravel_image::{Alignment, EncoderOptions, Format, Image};
let mut image = Image::decode("storage/app/photo.jpg")?;
image.cover(300, 200, Alignment::Center)?.grayscale();
let webp = image.encode_using_format(Format::Webp, EncoderOptions::new())?;See the README for the guide.
Structs§
- Avif
Encoder Encoders\AvifEncoder.- BmpEncoder
Encoders\BmpEncoder.- Color
- An RGBA color: Intervention Image’s
Colors\Rgb\Color, with 8-bit channels. - Driver
Config - The options of the driver: Intervention Image’s
Configclass, with its defaults. - Encoded
Image - Encoded image data with its media type: Intervention Image’s
EncodedImage. - Encoder
Options - The named options PHP passes as
...$options(quality: 65,progressive: true, …). Each encoder takes the options it knows and ignores the others, as PHP does. - Exif
- The Exif data of a decoded image, grouped like PHP’s
exif_read_data($file, null, true):IFD0,THUMBNAIL,EXIF,GPSandINTEROP. Integer tags are numbers, text tags are strings, other tags their readable value. - Frame
- One frame of an image. Still images have one, animated GIFs one per frame.
- GifEncoder
Encoders\GifEncoder.- Heic
Encoder Encoders\HeicEncoder.- IcoEncoder
Encoders\IcoEncoder.- Image
- An image: Intervention Image’s
Imageclass. - Image
Config - The settings of
config/intervention-image.php, with its defaults: - Image
Manager - The image manager: Intervention Image’s
ImageManager, bound in the container by theImageServiceProviderwith the application’s configuration (PHP’sImageManagerInterfaceinjection). TheImagefacade functions use it too. - Image
Response Factory Intervention\Image\Laravel\ImageResponseFactory.- Image
Service Provider - Registers the
ImageConfigsection with the defaults ofconfig/intervention-image.phpand binds the configuredImageManageras a singleton (PHP’sintervention.image,ImageManagerandImageManagerInterfacebindings): - Jpeg2000
Encoder Encoders\Jpeg2000Encoder.- Jpeg
Encoder Encoders\JpegEncoder.- JxlEncoder
Encoders\JxlEncoder.- Origin
- Where an image came from: Intervention Image’s
Origin. - PngEncoder
Encoders\PngEncoder.- Point
- A point:
Intervention\Image\Geometry\Point. - Size
- A size with a pivot point:
Intervention\Image\Size. - Tiff
Encoder Encoders\TiffEncoder.- Webp
Encoder Encoders\WebpEncoder.
Enums§
- Alignment
- A position relative to an image:
Intervention\Image\Alignment. - Colorspace
- The color space of an image. The pure-Rust driver works in 8-bit RGB with alpha, like PHP’s GD driver.
- Dimension
- A width or height argument:
null|int|Fractionin PHP. Pass a pixel count (300), aFraction, orNonefor “keep / calculate automatically”. - Direction
- The direction of
flip:Intervention\Image\Direction. - Encoder
- An encoder for
Image::encode_with: any of the encoder structs converts into it. - File
Extension - A file extension:
Intervention\Image\FileExtension. - Format
- An image format:
Intervention\Image\Format. - Fraction
- A size relative to the image’s own size:
Intervention\Image\Fraction. - Image
Error - An image couldn’t be decoded, modified, encoded or saved.
- Media
Type - A media type:
Intervention\Image\MediaType. - Source
- What
ImageManager::decodeaccepts: PHP’sdecode(mixed $source).
Constants§
- DEFAULT_
QUALITY - The default quality of the lossy encoders:
AbstractEncoder::DEFAULT_QUALITY.
Traits§
- Into
File Extension - A file extension argument: a
FileExtensionor its string. - Into
Format - Anything PHP accepts as a format identifier: a
Format,MediaType,FileExtensionor a string holding a media type or a file extension. - Into
Media Type - A media type argument: a
MediaTypeor its string. - Response
Format - The target format of a response: a
Format,MediaType,FileExtension, a string holding a media type or an extension, orNonefor the image’s original format (JPEG when it has none).
Type Aliases§
- Result
- The result of the package’s operations.