PHP code example of avalanche123 / imagine-bundle

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

    

avalanche123 / imagine-bundle example snippets


$avalancheService = $this->get('imagine.cache.path.resolver');

$cachedImage = $avalancheService->getBrowserPath($object->getWebPath(), 'my_thumb');

$cacheManager = $this->get('imagine.cache.manager');
$cachedPath = $cacheManager->cacheImage($this->getRequest()->getBaseUrl(), '/images/picture1.jpg', 'my_filter');
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),
    );
}
 php
<img src=" $this['imagine']->filter('/relative/path/to/image.jpg', 'my_thumb')