Install and run LiipImagineBundle in Symfony 2.1

Below are the steps that I followed:

  • In my composer.json the following is added:

    "require": { "imagine/Imagine": ">=0.2.8", "liip/imagine-bundle": "*@dev", .... } 
  • Type the following command at a command prompt:

     composer update Installing imagine/imagine (v0.4.0) Installing liip/imagine-bundle (dev-master f7d5e4d) 
  • After updating the composer, my directory structure inside the provider folder is as follows:

enter image description here

  1. Then update provider / composer / autoload_namespaces.php

      'Imagine' => $vendorDir .'/imagine/Imagine/lib/', 'Liip\\ImagineBundle'=>$vendorDir . '/liip/imagine-bundle/', 
  2. Registered Package:

     new Liip\ImagineBundle\LiipImagineBundle(), 
  3. Routing:

     # app/config/routing.yml _imagine: resource: . type: imagine 
  4. config.yml

      # app/config/config.yml liip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound } 
  5. Added twig template file:

     <img src="{{ asset('bundles/acmedemo/images/1.jpg') | imagine_filter('my_thumb') }}" /> 
  6. Open localhost / symfony / web / app_dev.php / demo / hello / test

There was no thumbnail generation. While looking at the source, I found the line:

  <img src="/symfony/web/app_dev.php/media/cache/my_thumb/symfony/web/bundles/acmedemo/images/1.jpg"> 

What did I miss? Can someone help me with this? I am using xampp 1.8 for windows xp with default settings

+4
source share
2 answers

When i replaced

  <img src="{{ asset('bundles/acmedemo/images/1.jpg') | imagine_filter('my_thumb') }}" /> 

with

  <img src="{{ 'bundles/acmedemo/images/1.jpg' | imagine_filter('my_thumb') }}" /> 

I got a thumbnail. I removed the asset () helper object from the branch and worked, but I don’t know how it works.

+6
source

You can do: <img src="{{ (asset('bundles/acmedemo/images/1.jpg')) | imagine_filter('my_thumb') }}" /> because the filter filters the full path to the image, and not only the one that is active () cointains, which means you can also include "asset ()"

thanks

+1
source

All Articles