Skip to content

Commit

Permalink
add readme info
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremytubbs committed Jun 6, 2018
1 parent c8cc69e commit 60510a9
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 4 deletions.
64 changes: 61 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,66 @@
**THIS PACKAGE IS STILL IN DEVELOPMENT**

# Image IIIF

add route patters for parameters
Package implements the [IIIF Image API 2.1](http://iiif.io/api/image/2.1/). The package is unopinionated about implementation and many `MUST` features are not included. It is a bring your own framework solution for PHP. Regex is provided within the config for validation of image request parameters.

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 || png || gif || webp)

Supports the `info.json` response for a indentifier.

Currently only tested with 'GD' Libray. If utilizing 'Imagick' more config options may become available.

Todo:
- support more formats (tif, pdf)
- figure out how to handle bitonal 1-bit images
- utilize [php-vips](https:/jcupitt/php-vips)
- setup demo / documentation site
- Laravel and Slim demo applications


#### Laravel image route example:

```php
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:

```php
Route::get('iiif/{identifier}/info.json',
function (Request $request) {
$file = storage_path('app/images/'.$request->identifier);

$factory = new \Conlect\ImageIIIF\ImageFactory;

## License
$info = $factory()->load($file)
->info($request->identifier);

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
return $info;
}
);
```
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"larapack/dd": "^1.0",
"phpunit/phpunit": "^7.0"
},
"suggest": {
"jcupitt/vips": "A fast image processing library with low memory needs.",
},
"autoload": {
"psr-4": {
"Conlect\\ImageIIIF\\": "src"
Expand Down
2 changes: 1 addition & 1 deletion config/iiif.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [

'driver' => 'gd', //'imagick',
'driver' => 'gd', //imagick, vips

'base_url' => 'http://packages.test',

Expand Down

0 comments on commit 60510a9

Please sign in to comment.