PHP code example of liip / imagine-bundle
1. Go to this page and download the library: Download liip/imagine-bundle 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/ */
liip / imagine-bundle example snippets
<img src=" $this['imagine']->filter('/relative/path/to/image.jpg', 'my_thumb')
$runtimeConfig = array(
"thumbnail" => array(
"size" => array(50, 50)
)
);
$imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');
/** @var CacheManager */
$imagineCacheManager = $this->get('liip_imagine.cache.manager');
/** @var string */
$resolvedPath = $imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');
class MyController extends Controller
{
public function indexAction()
{
/** @var FilterService */
$imagine = $this
->container
->get('liip_imagine.service.filter');
// 1) Simple filter, OR
$resourcePath = $imagine->getUrlOfFilteredImage('uploads/foo.jpg', 'my_thumb');
// 2) Runtime configuration
$runtimeConfig = [
'thumbnail' => [
'size' => [200, 200]
],
];
$resourcePath = $imagine->getUrlOfFilteredImageWithRuntimeFilters(
'uploads/foo.jpg',
'my_thumb',
$runtimeConfig
);
// ..
}
}