0

I want to integrate the LiipImageBundle in my Symfony 2.1 project.

I installed the bundle and the imagine/Imagine v.0.4.0 bundle via composer. It's seems to work fine, except, that the modified images are not saved.

The error.log states:

PHP Fatal error: Class 'Imagine\\Imagick\\Imagine' not found in /var/www/app/cache/prod/appProdProjectContainer.php on line 365

This line in appProdProjectContainer.php states:

protected function getLiipImagineService()
{
    return $this->services['liip_imagine'] = new \Imagine\Imagick\Imagine();
}

I have no idea if this is correct or not. Have you guys any idea why PHP cannot find the class?

Johannes Klauß
  • 10,676
  • 16
  • 68
  • 122
  • Did you install [imagick](http://php.net/manual/en/imagick.setup.php)? the only thing i can think of is that `Imagine\Imagick\Imagine` throws an Error if imagick is not installed, so the [autoloader](http://stackoverflow.com/questions/1579080/throwing-exceptions-in-an-spl-autoloader) thinks it couldn't load `Imagine\Imagick\Imagine` instead. – Gintro Jan 21 '13 at 15:49
  • Yes I did. `phpinfo()` states that it's active and using module version `3.1.0RC2`. – Johannes Klauß Jan 21 '13 at 16:04
  • Btw: I just deinstalled imagick and if so, Symfony will throw an error in the very `Imagine` class. So the class is really not found, but it's there. – Johannes Klauß Jan 21 '13 at 16:11
  • I switched to gd instead of imagemagick and it works. – Johannes Klauß Jan 21 '13 at 17:23

1 Answers1

0

Have you added Imagine to autoload. If you haven't then u can do like this:

  1. Open vendor/composer/autoload_namespaces.php
  2. Add

    'Imagine' => $vendorDir .'/imagine/Imagine/lib/',
    'Liip\\ImagineBundle' => $vendorDir . '/liip/imagine-bundle/',
    
sonam
  • 3,720
  • 12
  • 45
  • 66
  • You shouldn't change the content of `vendor/composer/autoload_namespaces.php` because the vendor folder usually isn't under SCM and this file can be auto re-generated. – meze Jan 22 '13 at 01:46
  • 1
    Nowhere. Run `php composer.phar dumpautoload` (of couse you must use composer to install Imagine) and it should changes everything that is needed. – meze Jan 22 '13 at 03:11
  • composer also re-generates this file, when using the command `update` or `install`. – Johannes Klauß Jan 23 '13 at 15:54