PHP code example of diarmuidie / imagerack

1. Go to this page and download the library: Download diarmuidie/imagerack 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/ */

    

diarmuidie / imagerack example snippets


$dependencies = 

$server->setHttpCacheMaxAge(86000); // 86000 seconds = 1 day

$server->setTemplate(
    'large',
    function () {
        return new Templates\Large();
    }
);

$server->setNotFound(function ($response) {

    // Edit the response as 'Image not found.');

    // Return the modified response
    return $response;

});

$server->setError(function ($response, $exception) {

    // Edit the response as ->setContent('An internal error occurred. ' . $exception->getMessage());

    // Return the modified response
    return $response;

});

root /some/folder/public;
index  index.php;

location ~ \.php$ {
    ...
    try_files $uri $uri/ /index.php?$args;
    ...
}