PHP code example of conlect / image-iiif

1. Go to this page and download the library: Download conlect/image-iiif library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

conlect / image-iiif example snippets


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;
    }
);


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;
    }
);