I'm using tinymce and img_assist

I deleted an image and after this I edited the node which had this image embedded.
I selected the image and clicked on the img_assist-icon in the tinymce-toolbar

I got this message
(on: /index.php?q=img_assist/load/tinymce)

Division by zero in /srv/www/htdocs/web2/html/jugendgruppen/nord/drupal/modules/img_assist/img_assist.module in Line 790.

I think I should get a message which tells me that the image could not be found an that I can select another image (start over)

Comments

Lupin3rd’s picture

I have the same problem with Img_assist 4.7.0, TinyMCE 4.7.0 with Drupalimage plugin active:
warning: Division by zero in /var/www/.../modules/contrib/img_assist/img_assist.module on line 794.

bastien-1’s picture

Version: 6.x-3.x-dev » 4.7.x-1.x-dev
Component: Code » User interface

same here, is there a workaround?

davina’s picture

i'm getting the same error:
Division by zero in /home/users/.../modules/contrib/img_assist/img_assist.module on line 794.

davina’s picture

Title: Division by zero... » a fix for "division by zero" problem

goto administer > settings > content types.

choose "configure" for the image content type.

choose at least "10" for the "minimum number of words" in the "submission form" section. the description for this field is "The minimum number of words a image must be to be considered valid." methinks line 790 or 794 of the img_assist.module is dividing by whatever number you choose here. the text you input will be added to a nice little caption for your image.

hope this works for y'all.

-d.

mandclu’s picture

Nope, I tried changing the minimum length to 10, it still gave me the divided by zero error, only now it also requires a bodt description of at least ten words. The problem seems to be that the image_get_info call on 783 isn't working properly, returning false instead of the array expected. You'd think there woudl be a check for this before going ahead and dividing by a value that could be zero if the expected numerical value isn't present.

Here's what I get when I do a var_dump on $node just before image_assist_properties tries to generate the file path:
object(stdClass)#8 (2) { ["title"]=> string(0) "" ["body"]=> string(0) "" }

For me, this happens whenever I try to add an image, and in this case, at least, it seems there is a larger problem at work.

davina’s picture

yeah, i'm back getting the same problem. i'm also getting

* The selected file /home/users/.../public_html/files could not be copied.

which i think is an image.module problem, but i can't for the life of me get it to work even when applying patches.

erg.

davina’s picture

Title: a fix for "division by zero" problem » try disabling "attach images" and "attachments" for image content type

this has fixed both the "divide by zero" and "could not be copied" errors for me.

goto administer >settings > content types

choose "configure" for the "image" content type

select "disabled" for both "attach images" and "attachments"

hope this works for you.
-d.

John Hodgins’s picture

i'm having the same problem (divide by zero) and the fix isn't working for me. i have an almost identical site on the same server using img_assist with no problems. i'm using i18n and views with this install, but can't see how they would interfere. image gallery is also broken -- it doesn't appear under categories when i create a new image -- but this may not be related. is anyone else still having this problem?

John Hodgins’s picture

nevermind. it was my internationalization settings that were causing the problem. image assist won't select images that internationalization settings wouldn't normally display. so if you upload a picture through image assist and set it's language to french while you're working in english, image assist will be unable to find it, and will have a width and height for the image of zero (hence the error). kind of expected behaviour, i suppose, though other modules allow you to edit nodes that wouldn't be displayed with your current language settings. a heads-up for internationalization users, anyway...

darren oh’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)