Uploading images with img_assist doesn't work

jippie1948 - July 7, 2006 - 12:48

Hi there,

When I try to upload an image in img_assist window I get the following error message:

* The selected file /homepages/28/d41073845/htdocs/drupal/sites/www.tact.co-cornucopia.org/files could not be copied.
* warning: Division by zero in /homepages/28/d41073845/htdocs/drupal/modules/contrib/img_assist/img_assist.module on line 794.

In the image directory there is a 0KB image file and the events log mentions that I have uploaded an image.

Questions:
1. What might have gone wrong?

2. What logical steps can I take to check whether I have installed everything right?

Looking forwards to hearing from you.

JanPieter.

PS. Uplodaing files and avatars goes fine. The upload file setting has been set to private.
The Add Image thumbnail appears below text areas.
TinyMCE works fine.

Same issue.

stledger - July 13, 2006 - 14:46

I am wondering if this has been resolved as I can't seem to find it if it has.

I am also suffering the exact same problem. I have checked the permissions on the file system, chmod +rwx on the files folder etc. I've tried using public and private files.

This is happening on a completely clean install 4.7.2 with only the image (4.7.0) module installed.

Can anyone shed any light on this?

Many thanks.

same problem here

davina - July 14, 2006 - 17:45

* The selected file /home/users/d/dharma/public_html/files could not be copied.
* warning: Division by zero in /home/users/d/dharma/public_html/modules/contrib/img_assist/img_assist.module on line 794.

i think the first is an image.module problem?

-d.

www.dharmatech.org

2 image upload forms?

ahunter - July 17, 2006 - 00:40

hi, i was having the same problem -> create content -> image (w/ d:4.7.2)

i have _two_ image upload forms. (1 at top 1 at bottom) if i use second form then it works correctly for me. maybe there are some variable names being overwritten?

Division by zero Line 794

gorbot - July 18, 2006 - 05:43

Hi,
I was experiencing this exact same error but it appears I am able to avoid it now.
I believe the error could be related to the taxonomy_access module. It seems the taxonomy_access module is doing exactly what it should do, but as a result can trigger this error from the img_assist module.
Basically, all I did was carefully go through the [Administrator | access control | category permissions] from the perspective of the user role that was experiencing the error.

I noticed that I did not give adequate permissions to the role related to the "Image Galleries" and "Uncategorized nodes" (I had some images that I didn't categorize)
After I updated the access control permissions it worked like a charm without the error.

I hope this helps.
Cheers

disable "attach images" for image content type

davina - July 17, 2006 - 17:24

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.

www.dharmatech.org

Thanks, Davina

jippie1948 - July 18, 2006 - 11:23

I applied your sugestion and it worked! Thanks,

JanPieter

I also have this problem.

mgrant - August 3, 2006 - 22:53

I also have this problem.

I spent several hours debugging it.

The problem appears to be with image_exact. It's not getting the source filename properly, I'm not sure why, but this actually starts off a chain of events which cause the division by zero problem later on.

At modules/image_exact/image_exact.module:80 we see:
$source = file_create_path($node->images['_original']);

$node->images['_original'] is null for some reason. $node->images contains array ( '_original' => '', 'thumbnail' => '', 'preview' => '', ). This makes file_create_path() return 'files', which is a directory.

Since this isn't a file (it's a directory), at modules/image_exact/image_exact.module:128, image_resize gets called with $destination as both the source and destination, and in this case it's the directory named 'files'. So the gd lib happily reads this dir as an image and tries to resize it and outputs a file which looks like a directory dumped in ascii.

Later on at modules/img_assist/img_assist.module:783, it tries to get the size of this image, but it's not an image, so it returns null. Therefore, the height, which is used at line 794 is 0 and this results in our division by zero error.

What I don't know is if this is a bug or if I've misconfured something.

Michael Grant

I resolved this by adding

mgrant - August 5, 2006 - 16:22

I resolved this by adding the following to my php.ini:

upload_tmp_dir = "/tmp"

See the bug report that I posted here http://drupal.org/node/77065

Michael Grant

 
 

Drupal is a registered trademark of Dries Buytaert.