conlect / image-iiif
IIIF Image API 3.0
Installs: 6 806
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^8.2
- hassankhan/config: ^3.2.0
- intervention/image: ^3.6.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.21.1
- larapack/dd: ^1.1
- phpunit/phpunit: ^11.5.0
Suggests
- ext-gd: to use GD library based image processing.
- ext-imagick: to use Imagick based image processing.
This package is auto-updated.
Last update: 2024-12-13 13:49:55 UTC
README
Image IIIF
This package implements the IIIF Image API 3.0, it is unopinionated about implementation and many of the MUST
features are not included because it does not include an actual implementation only the means to create one. I consider it a bring your own framework solution for implementing Image API 3.0 with PHP. The package utilizes the Intervention Image package for manipulations. I have provided Intervention filters for each of the 5 IIIF parameters that can be used independently of the $factory()->load()->withParameters()
pipeline methods.
Supports all Image Request Parameters:
- Region (full || square || x,y,w,h || pct:x,y,w,h)
- Size (full || max || w, || ,h || pct:n || w,h || !w,h)
- Rotation (n || !n)
- Quality (color || gray || default)
- Format (jpg || tif || png || gif || webp)
Supports the info.json
response for an identifier.
Laravel image route example:
Route::get('iiif/{identifier}/{region}/{size}/{rotation}/{quality}.{format}', function (Request $request) { $parameters = $request->route()->parameters(); $file = storage_path('app/images/'.$parameters['identifier']); $factory = new \Conlect\ImageIIIF\ImageFactory; $file = $factory()->load($file) ->withParameters($parameters) ->stream(); $response = \Response::make($file); $response->header('Content-Type', config("iiif.mime.{$parameters['format']}")); return $response; } );
Laravel info route example:
Route::get('iiif/{identifier}/info.json', function (Request $request) { $file = storage_path('app/images/'.$request->identifier); $factory = new \Conlect\ImageIIIF\ImageFactory; $info = $factory()->load($file) ->info($request->identifier); return $info; } );