I am new to Drupal, I am trying to move an existing site from serverA to serverB.

When I visit


I get Error generating image.

I am using Drupal 7.22, on an ubuntu server, PHP Version 5.4.9, have php5-gd and mod_rewrite installed and activated. Error log of apache server is empty. I also have the following directories created.

mkdir -p /var/www/sites/all/files/styles/thumbnail
mkdir -p /var/www/sites/default/files/styles/thumbnail
chmod 777 /var/www/sites/all/files/styles -R
chmod 777 /var/www/sites/default/files/styles -R

How can I fix/find the source of this problem. Where should I look for some useful error logs.

  • 2
    @see drupal.org/node/244924 for Securing file permissions and ownership – revagomes Jul 23 '13 at 6:17
  • @revagomes good point - even if bad permissions probably wasn't first source of a problem (see my answer) it may be one now as 777 is not exactly suited for files and server may flatly refuse overwriting executables. – Mołot Jul 23 '13 at 11:21

Problem is - you are trying to generate styled image, but you do not provide security token. In Drupal 7.20 and later security token is required so images are only generated when Drupal site itself tries to use them. To turn it off, just add the following line to your settings.php file:

$conf['image_allow_insecure_derivatives'] = TRUE;

Solution taken from this answer and 7.20 release notes.

  • 1
    It'd be worth mentioning the drawbacks of using this 'solution' and in particular, the security vulnerabilities related. Information here; drupal.org/drupal-7.20-release-notes – Christian Dec 10 '13 at 4:07
  • @Christian why do you wrote word solution in parenthesis, and not "security vulnerabilities"? The only "risky" thing is potential DoS due to generation abuse, and it's only on a servers with configuration that's unsuitable for production anyway. There is not a single problem with it if the site is only accessed by it's owner, and only for migration, as described in the question. – Mołot Dec 10 '13 at 7:53
  • Because I don't consider disabling core functionality a 'solution' - more a bandaid fix. I would argue that many users of this site use configuration that is not suitable for a production environment and hence would like to see any potential security implications, however remote they may be, mentioned. That is all. – Christian Dec 10 '13 at 12:08
  • @Christian discussion if this token is useful or not already happened on Drupal.org and as a result we have a core feature to disable that token, as arguments against it was strong enough. If someone wants to be able to access things directly, it's his choice and recreating discussion from Drupal.org here in comments is pointless. – Mołot Dec 10 '13 at 12:23
  • I'm not recreating a discussion, you asked me a question! – Christian Dec 10 '13 at 23:02

If all permissions are correct. Make sure that ImageMagick is installed on your server for PHP5.

Just run the following commands:

sudo apt-get install imagemagick

sudo apt-get install php5-imagick

Source: https://stackoverflow.com/a/18150533


FWIW : in my case the problem was that the original image contained errors, so it seems logic that the derivative couldn't be created

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.