PHP code example of nckg / imageme
1. Go to this page and download the library: Download nckg/imageme 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/ */
nckg / imageme example snippets
Route::get('/my_image_path/{modifiers}/{src}', function($modifiers, $src)
{
$directory = Config::get('upload.display_path');
$imageMe = new \Nckg\ImageMe\ImageMe;
// optional: save to the filesystem
$storage = new \Nckg\ImageMe\Storage\FileSystem($directory.DIRECTORY_SEPARATOR.$modifiers, $src);
$imageMe->addStorage($storage);
// resize
$image = $imageMe->make($directory, $src, $modifiers);
// return image response
return $image->response();
})
->where('modifiers', '^((w|h)\d+(\-?))+$')
->where('src', '.*\.(?:jpg|gif|png|jpeg)$');