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.

Comments

pyrollo’s picture

Status: Active » Needs review
FileSize
9.32 KB

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

pyrollo’s picture

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

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

Aeonius’s picture

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

pyrollo’s picture

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 .

Aeonius’s picture

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.

Mark Trapp’s picture

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.

fietserwin’s picture

Works here as well (Windows Vista)

Mark Trapp’s picture

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

crysaz’s picture

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

Mark Trapp’s picture

Status: Reviewed & tested by the community » Needs work

Can confirm. Will look into fixing that later today.

pyrollo’s picture

Status: Needs work » Needs review
FileSize
9.34 KB

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.

adrinux’s picture

Status: Needs review » Reviewed & tested by the community

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

sun’s picture

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

@Kambiyaso’s picture

Hi Pyrollo

I applied the patch as stated but I am still getting the errors:

Warning: Division by zero in theme_image_style_preview() (line 804 of /Applications/XAMPP/xamppfiles/htdocs/maji_new_site_wcdt/modules/image/image.admin.inc).
Warning: array_intersect_key(): Argument #1 is not an array in theme_image_style_preview() (line 806 of /Applications/XAMPP/xamppfiles/htdocs/maji_new_site_wcdt/modules/image/image.admin.inc).

axlroach’s picture

Hi @Kambiyaso,

Did you try checking to make sure the sites/default/files/styles directory (and all the directories beneath it in the file structure) has write permissions?

cayerdis’s picture

I had this problem too because I did not have the right permissions for sites/default/files

nicodv’s picture

Same here, the problem was permissions on the sites/default/files/styles directory

cllamas’s picture

I have 775 in files and files/styles

I have owner and group _www (OSX).

But still doesn't generate styles. (I actually had to create files/styles myself)

leymannx’s picture

Had to sudo chmod -R 777 files/ since some images I uploaded had wrong permissions.