• Unable to generate the derived image located at....
  • The selected image handling toolkit imageapi_optimize can not correctly process image_imageapi_optimize_get_info.

I am getting these two errors with the D7 dev branch.

I'm running the latest D7 with ImageAPI dev (from 25th Feb)... ImageMagick 7.x-1.0-alpha2.

I get the following errors in admin...

Warning: Division by zero in theme_image_style_preview() (line 769 of /var/www/html/drupal7/drupal/modules/image/image.admin.inc).
Warning: array_intersect_key(): Argument #1 is not an array in theme_image_style_preview() (line 771 of /var/www/html/drupal7/drupal/modules/image/image.admin.inc).
Warning: Division by zero in theme_image_style_preview() (line 786 of /var/www/html/drupal7/drupal/modules/image/image.admin.inc).
Warning: array_intersect_key(): Argument #1 is not an array in theme_image_style_preview() (line 788 of /var/www/html/drupal7/drupal/modules/image/image.admin.inc).

Investigating...

Comments

nicholasThompson’s picture

The problem exists between GD and ImageMagick too...

I have optipng and jpegtran enabled. The problem exists even if I remove all of these...

EDIT: Also get an error with Yahoo SmushIt too...

nicholasThompson’s picture

If it makes any difference - I'm running nGinx 0.7. If I disable ImageAPI Optimize, my styles generate properly so I dont *believe* its a configuration issue...

nicholasThompson’s picture

Category: bug » support

Hmm.. So emptying cache made a difference. Seems to be working now.

I'm wondering if the hook_init implementation doesn't quite work correctly if the module is enabled during "drush en"?


/**
 * Implements hook_init().
 *
 * Abstract layer to all methods implemented by base toolkit.
 */
function imageapi_optimize_init() {
  if (! $cache = cache_get('imageapi_optimize:methods')) {
    $methods = _imageapi_optimize_get_methods();
  }
  else {
    $methods = $cache->data;
  }

  foreach ($methods as $method) {
    eval('function image_imageapi_optimize_'.$method.'($image) {
      $params = array_slice(func_get_args(), 1);
      return _imageapi_optimize_invoke("'. $method .'", $image, $params);
    }');
  }
}

I'm not entirely sure what the purpose of this is... Is it to dynamically generate functions?

jcisio’s picture

Status: Active » Fixed

Other modules, like imagecache_actions, are implemented as if there are only 2 toolkits (D6): gd and imagemagick. That piece of code is from #852860: Support imageapi actions implemented by other modules and it does what you said. The patch in that issue is fairly self-explained.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

vlajkop’s picture

I had exactly the same error messages on my developer machine and as I figured problem was in permissions setting for folder /path-to-your-drupal-web-folder/sites/default/files/styles/. Owner of styles folder was my linux local username instead of www-data (Apache web server). I'm guessing this was missconfigured during drupal 7 installation or core update since this was the only affected folder under /sites/default/files/.

After changing ownership and leaving permissions to drwxrwxr-x problem was solved and all subfolders needed for media library and thumbnails were created. Also submitting settings for images in /admin/config/media/image-styles to overwrite default theme settings didn't hurt.

nicholasThompson’s picture

For my own future reference...

You need to use: http://drupal.org/project/imagemagick

The module bundles with ImageAPI (imageapi_imagemagick.module) doesn't contain the get_info() function.

Solution: Enable the ImageMagick module, save the Image Toolkit settings page and flush cache...

dieppon’s picture

You were right, I changed the permissions and flushed the caches and all the thumbnails were rebuild and the errors disapeer, thanks!

codesidekick’s picture

I've done all the comments suggested above. Uninstall, reinstalled, enabled with drush, enabled with admin, CHMOD'd file directories etc. Just trying to use it with Yahoo Smushit but I'm getting the same two PHP errors as in the top post. It's pretty much a fresh install but I'll try it with a totally new Drupal install and see if it fixes it and let you know.

RaulMuroc’s picture

Status: Closed (fixed) » Active

And which where the results of @martysnow?

The same problem, getting:

Unable to generate the derived image located at public://styles/public... which all permisions correct (even with 777). And is curious because in the directory styles there are Style1 and Style2 sub-folders and into Style1 the pictures are greatly created and in Style2 is where they are not created... and both folders has the save permissions.

codesidekick’s picture

I didn't get anywhere on this and elected not to use the module unfortunately. Opted to do most of my image styling with CSS instead and force JPGs on the user to get around the whole PNG's are huge issue.

jcisio’s picture

Status: Active » Closed (fixed)

Nothing new. Revert the status.

brylie’s picture

Status: Closed (fixed) » Active

We are getting this error on a D7.16 install, even with standard image names (no special characters).
"Unable to generate the derived image located at public://styles/thumbnail/public/..."

Our setting for public images folder seems to be correct.

The following page displays a rotating block on the right hand side:
https://www.friendlywater.net/projects/mutaho

Each item in the block is supposed to, and used to, display an image of the person. Instead, a generic image holder appears. When I copy the image source into the URL bar, I get the following error:
"Error generating image."

See: https://www.friendlywater.net/sites/friendlywater.net/files/styles/thumb...

We are running:
PHP 5.4.3
Drupal 7.16

jcisio’s picture

Did you try to get a more verbose error message?

corey.aufang’s picture

I was also getting this error after installing the module using Drush.

A quick flush of the cache resolved the issue.

jcisio’s picture

Status: Active » Closed (fixed)

Revert the title again because of #15.

grkm2002’s picture

Title: Images not generating - two errors. » Image style preview not generating - two errors.

I'm getting the following errors. Unable to get any image preview. Using Drupal 7.19 with imagemagic.
I've already flushed my cache and still get the same problem. Can anyone provide any help?


    Warning: Division by zero in theme_image_style_preview() (line 786 of /var/www/drupal7/modules/image/image.admin.inc).
    Warning: array_intersect_key(): Argument #1 is not an array in theme_image_style_preview() (line 788 of /var/www/drupal7/modules/image/image.admin.inc).

cfox612’s picture

I'm also getting these errors. I've flushed my cache multiple times, and insured that the directory permissions are set to 777.

achton’s picture

Issue summary: View changes

I can confirm that flushing the cache fixes this issue, with 1.0 and dev version. ImageMagick is installed also FWIW. No configuration changes could fix it, nor deleting all image style folders. Only clearing cache worked.

Melissamcewen’s picture

I had this issue too and fixed it by going to the settings and selecting at least one binary in "Internal tools". This could probably be solved by have a default binary if this is indeed the cause for much of this.

hashtivist’s picture

guys, just specify the path to your binary.
4 ubuntu : /usr/bin/convert