Download the PHP package dalpras/image-processor without Composer
On this page you can find all versions of the php package dalpras/image-processor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download dalpras/image-processor
More information about dalpras/image-processor
Files in dalpras/image-processor
Download dalpras/image-processor
More information about dalpras/image-processor
Files in dalpras/image-processor
Vendor dalpras
Package image-processor
Short Description Unified image-processing library based on Imagick, offering stateless service + composable operations.
License MIT
Package image-processor
Short Description Unified image-processing library based on Imagick, offering stateless service + composable operations.
License MIT
Please rate this library. Is it a good library?
Informations about the package image-processor
image-processor
A modular, stateless image processing toolkit for PHP built on Imagick.
Compose powerful pipelines with simple, reusable operations for resizing, cropping, transforming, filtering, watermarking, and more.
โจ Features
- Composable: Chain any number of operations for advanced image workflows
- Rich Operations: Resize, crop, fit, filter, overlay, watermark, rotate, background, and more
- Strict typing: PHP 8.1+, PSR-4, Psalm/PHPStan ready
- No /tmp clutter: Uses dedicated temp folders for all operations
- Modern API: Pass closures or handler objects for complete flexibility
- Robust: Handles missing files, fallbacks, and generates placeholder images automatically
๐ฆ Installation
Or, add to your composer.json:
๐ Quick Start
๐ ๏ธ Supported Operations
All operations return an ImageHandle for use in the operations pipeline.
Resize
resize(int $width, int $height, bool $keepAspect = true): ImageHandleresizeByRatio(int $dim, bool $isWidth = true): ImageHandle
Fit/Fill
fitToTarget(int $targetWidth, int $targetHeight, string $mode = 'fit', string $anchor = 'center', string $background = 'white'): ImageHandle- Modes:
fit,fitWidth,fitHeight,fill
- Modes:
Crop & Trim
crop(int $width, int $height, int $x, int $y): ImageHandletrim(string $background = 'white'): ImageHandle
Background
backgroundColor(string $color): ImageHandle- Sets the image background color (useful before flattening or composing).
Clip (Alpha Mask)
clipPath(bool $inside = false): ImageHandle- Uses 8BIM clipping path #1 for precise masking.
Overlay (Text)
overlay(string $text, int $x, int $y, string $font = null, int $size = 20, string $color = 'black', ?float $opacity = null, int $angle = 0, int $align = Imagick::ALIGN_LEFT): ImageHandle- Adds text overlay at specified coordinates with style options.
Transform
rotate(float $degrees): ImageHandle- Rotates image by specified degrees.
Watermark
watermark(string $path, string $position = 'center', ?float $opacity = null): ImageHandle- Overlays an image as a watermark. Supports all corners and center.
Filter
filter(string $type, ...$args): ImageHandle- Image filters supported:
grayscalesepia(optionally with threshold)blur(with radius & sigma)- Extend with more as needed!
๐ API Reference
ImageProcessor
__construct(?string $tempDir = null)process(string $imagePath, array $options = []): ImageInfo
Options
| Key | Type | Default | Description |
|---|---|---|---|
| outputDir | string | image path | Where to write the output image |
| outputExt | string | 'webp' | Output image extension/format |
| force | bool | false | Overwrite output if it exists |
| operations | array | [] | List of ImageHandle operations |
| fallback | string | null | Fallback image path if source is missing |
ImageInfo
Returned from process().
Extends SplFileInfo, with:
getWidth(): intgetHeight(): intgetRatio(): floatgetInlinePng(): stringโ Data URI for HTML<img src>getSpaceHolder(): stringโ SVG placeholder (for lazy loading, etc.)
๐ Symfony Integration Example
๐งช Testing
๐ค Contributions
Contributions are welcome!
Open an issue or submit a pull request.
๐ License
MIT ยฉ Stefano Dal Prร
All versions of image-processor with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
ext-imagick Version *
ext-imagick Version *
The package dalpras/image-processor contains the following files
Loading the files please wait ...