Skip to main content

Crate laravel_image

Crate laravel_image 

Source
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§

AvifEncoder
Encoders\AvifEncoder.
BmpEncoder
Encoders\BmpEncoder.
Color
An RGBA color: Intervention Image’s Colors\Rgb\Color, with 8-bit channels.
DriverConfig
The options of the driver: Intervention Image’s Config class, with its defaults.
EncodedImage
Encoded image data with its media type: Intervention Image’s EncodedImage.
EncoderOptions
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, GPS and INTEROP. 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.
HeicEncoder
Encoders\HeicEncoder.
IcoEncoder
Encoders\IcoEncoder.
Image
An image: Intervention Image’s Image class.
ImageConfig
The settings of config/intervention-image.php, with its defaults:
ImageManager
The image manager: Intervention Image’s ImageManager, bound in the container by the ImageServiceProvider with the application’s configuration (PHP’s ImageManagerInterface injection). The Image facade functions use it too.
ImageResponseFactory
Intervention\Image\Laravel\ImageResponseFactory.
ImageServiceProvider
Registers the ImageConfig section with the defaults of config/intervention-image.php and binds the configured ImageManager as a singleton (PHP’s intervention.image, ImageManager and ImageManagerInterface bindings):
Jpeg2000Encoder
Encoders\Jpeg2000Encoder.
JpegEncoder
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.
TiffEncoder
Encoders\TiffEncoder.
WebpEncoder
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|Fraction in PHP. Pass a pixel count (300), a Fraction, or None for “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.
FileExtension
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.
ImageError
An image couldn’t be decoded, modified, encoded or saved.
MediaType
A media type: Intervention\Image\MediaType.
Source
What ImageManager::decode accepts: PHP’s decode(mixed $source).

Constants§

DEFAULT_QUALITY
The default quality of the lossy encoders: AbstractEncoder::DEFAULT_QUALITY.

Traits§

IntoFileExtension
A file extension argument: a FileExtension or its string.
IntoFormat
Anything PHP accepts as a format identifier: a Format, MediaType, FileExtension or a string holding a media type or a file extension.
IntoMediaType
A media type argument: a MediaType or its string.
ResponseFormat
The target format of a response: a Format, MediaType, FileExtension, a string holding a media type or an extension, or None for the image’s original format (JPEG when it has none).

Type Aliases§

Result
The result of the package’s operations.