Download & Extend

No image_info function leading to a "division by zero" message

Project:ImageAPI
Version:7.x-1.x-dev
Component:ImageAPI Imagick
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

Once fixed the Undefined index: #post in imageapi_imagemagick_validate_path() issue, ImageMagick toolkit is still not working on Drupal 7.0 beta 3, 2010-11-13.

When clicking on any style in Administration/Configuration/Media/Image styles, the following message is displayed :

Warning: Division by zero in theme_image_style_preview() (line 772 of /srv/principal/www/d7/modules/image/image.admin.inc).
Warning: array_intersect_key(): Argument #1 is not an array in theme_image_style_preview() (line 774 of /srv/principal/www/d7/modules/image/image.admin.inc).
Warning: Division by zero in theme_image_style_preview() (line 789 of /srv/principal/www/d7/modules/image/image.admin.inc).
Warning: array_intersect_key(): Argument #1 is not an array in theme_image_style_preview() (line 791 of /srv/principal/www/d7/modules/image/image.admin.inc).

No image is displayed. Clicking on effect result "view actual size" link, I get a "Error generating image." page.

This problem is due to lacking image_imageapi_imagemagick_get_info function in ImageMagick toolkit. This function is used by drupal to get image size.

Here is a patch which :

This is not perfect, there is still some missing things like checking the identify path but before going further I wanted to have some opinions about it.

AttachmentSize
missing_image_info.patch5.22 KB

Comments

#1

Status:active» needs review

Here is a new version of the patch, including path and version test for "identify".

AttachmentSize
missing_image_info.patch 9.32 KB

#2

I tested issue and patch on drupal 7.0-rc2 today.

Issue is still there and the patch is still solving it.

#3

I am getting the same error. I have to install patches manually due to shared hosting. Where is this file located? I simply can't find "cvs/drupal-contrib/contributions/modules/imageapi/imageapi_imagemagick.module" In my Drupal folder I have the following:
-includes
-misc
-modules
-profiles
-scripts
-sites
-themes

Thank you

#4

This file is located in one of your modules directory, depending on where you installed the imageapi module (either modules, sites/all/modules, sites/default/modules or sites/yoursite.com/modules). The precise location is then : modules/imageapi/imageapi_imagemagick.module .

#5

I am such a tool. I searched the error on Google and ended up here. I totally forgot to check which module this issue was about, I just matched the error with the one I got (also on that same line...), but I do not have the imagemagic module installed. Anyway, the error seems to have vanished into thin air. I hope it stays that way. Thank you for your quick response! Sorry to waste your time.

#6

Status:needs review» reviewed & tested by the community

Been using the patch in #1 extensively for the past 2 weeks: works as described. Implementing imageapi_imagemagick_get_info() is required for image_load() as well.

#7

Works here as well (Windows Vista)

#8

Rerolled patch to correct minor coding standards issues and remove extraneous whitespace.

AttachmentSize
imageapi-989130-8-missing_image_info.patch 9.33 KB

#9

Patch works so far, but it breaks filenames containing spaces.

#10

Status:reviewed & tested by the community» needs work

Can confirm. Will look into fixing that later today.

#11

Status:needs work» needs review

Here is a fixed patch.

That was a silly mistake, I forgot to escape file name in the identify command. The only difference with the previous patch is a call to escapeshellarg in line 110.

AttachmentSize
missing_image_info.patch 9.34 KB

#12

Status:needs review» reviewed & tested by the community

Works for me. Errors gone and now able to use imagemagick :)

#13

This has been fixed in http://drupal.org/project/imagemagick already