Download the PHP package quazardous/imagestack without Composer
On this page you can find all versions of the php package quazardous/imagestack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quazardous/imagestack
More information about quazardous/imagestack
Files in quazardous/imagestack
Package imagestack
Short Description A PHP Image Serving Framework
License MIT
Informations about the package imagestack
ImageStack
A PHP image serving framework.
The main goal is to provide a robust framework to create an "on the fly" image thumbnailer generator similar to imagecache / image style in Drupal.
This project is only the framework part. The framework is brick designed so that you can put together your own image serving project and add special bricks.
Framework integration:
- Symfony 4 bundle: Imagestack Bundle
- Silex provider: SilexImageStack
Installation
composer require quazardous/imagestack
Concept
Typical flow
This describes the typical processing we want to achieve.
When the front controller handles an image HTTP request:
- the front controller will call image stack with the image path.
- the image stack will fetch the image using the image backend.
- the image stack will apply image manipulator.
- the image stack will store the image using the storage backend.
- the image stack will return the image to the front controller.
- the front controller will serve the image.
Ideally the image file will be stored so that the next HTTP request will be statically served.
Lexicon / bricks
Image path
The path of the image that could come from the front controller.
See ImageStack\Api\ImagePathInterface
.
Image
The image content we are willing to serve.
See ImageStack\Api\ImageInterface
.
Image backend
Something that can provide image content.
See ImageStack\Api\ImageBackendInterface
.
Image manipulator
Service that can modify/transform/optimize the image content.
See ImageStack\Api\ImageManipulatorInterface
.
Storage backend
Something where we can store the image content.
Typically we could store it onto the file system so that next HTTP query will be statically serve.
See ImageStack\Api\StorageBackendInterface
.
Image stack
Top of the iceberg class.
See ImageStack\Api\ImageStackInterface
.
Usage
Code example
This pseudo controller creates an image stack that will:
- fetch image from
https://images.example.com/backend/
+$path
- optimize it with
jpegtran
- store it on
'/var/www/my/local/image/storage/'
+$path
- serve it
Implementation
Image stack
A basic image stack.
See ImageStack\ImageStack
Image backends
File image backend
See ImageStack\ImageBackend\FileImageBackend
HTTP image backend
See ImageStack\ImageBackend\HttpImageBackend
Cache image backend
Add a cache layer before an image backend.
See ImageStack\ImageBackend\CacheImageBackend
Sequential image backend
Sequentially fetch image from a queue of image backends and return the first match.
See ImageStack\ImageBackend\SequentialImageBackend
Image manipulators
Converter image manipulator
Convert image type.
See ImageStack\ImageManipulator\ConverterImageManipulator
Optimizer image manipulator
Optimize image.
See ImageStack\ImageManipulator\OptimizerImageManipulator
jpegtran
wrapper, see ImageStack\ImageOptimizer\JpegtranImageOptimizer
.
pngcrush
wrapper, see ImageStack\ImageOptimizer\PngcrushImageOptimizer
.
Thumbnailer image manipulator
Create an image thumbnail with (path) rules.
See ImageStack\ImageManipulator\ThumbnailerImageManipulator
Path pattern rule, see ImageStack\ImageManipulator\ThumbnailRule\PatternThumbnailRule
You can associate path patterns to thumbnail formats:
Watermark image manipulator
Add watermark to images.
See ImageStack\ImageManipulator\WatermarkImageManipulator
Tests
Edit/adapt tests/config.php
.
Dependencies / support
Tested against PHP 7.1.
Current implementation uses Imagine.
You will need either php-gd
, php-gmagick
or php-imagick
.
Wrappers for external optimizer:
History
- 1.5: add animated GIFs support in thumbnail and watermark (Imagick only)
- 1.4: add optimize gifsicle
- 1.3: allow backend to have image manipulator
- 1.2: add watermark
- 1.1: add path rules
- 1.0: current version
- 0.9: pre version mainly a raw copy/paste from an old project
Credits
License
MIT
All versions of imagestack with dependencies
imagine/imagine Version ^0.6
guzzlehttp/guzzle Version ^6.2
doctrine/cache Version ^1.6