Error: Division by zero

skizzo - January 3, 2009 - 11:29
Project:Taxonomy Image
Version:6.x-1.x-dev
Component:Contrib Blocks
Category:bug report
Priority:normal
Assigned:NancyDru
Status:closed
Description

I just upgraded to the latest build (Jan 3). When visiting a node the (previously working) taxonomy image is displayed in the block at full size, 640x480, as if the imagecache preset were not applied. The following error gets logged. The image is displayed with the right preset in the module's admin page.
warning: Division by zero in sites/all/modules/taxonomy_image.module on line 144.

#1

NancyDru - January 3, 2009 - 15:37

I saw this too but it went away after I made sure that the non-Imagecache size was also chosen. When working on #348121: Multiple blocks, multiple presets, I discovered that the resizing code was backwards, so re-saving the settings may be necessary.

#2

skizzo - January 4, 2009 - 09:39

I am still seeing the problem with the latest build, 5.x-1.x-dev 2009-01-04 (installed after admin/build/modules/uninstall of previous version). I have set the resizing via "Resizing Options - Imagecache", while "Resizing Options - Taxonomy Image" is set to "Disabled". That should be enough, right? BTW, thank you for the new Admin Preset option, it works nicely :-)

#3

NancyDru - January 5, 2009 - 18:09
Assigned to:Anonymous» NancyDru
Status:active» fixed

I added a few checks; everything is working for me. Committed to both branches.

#4

skizzo - January 6, 2009 - 11:52

Re-installed from scratch but no joy... Could it have something to do with the fact that my site is centered around the Domain module? I remember that I stepped into "problems with Variables" when I tried to use Forum. Please see http://drupal.org/node/214181#comment-708654 . Does Taxonomy Image make special use of stored variables? I have multiple domains (i.e.: alfa.example.com, beta.example.com) but I thought that it would be transparent to Taxonomy Image. If you need any clarification about potential Domain Access interactions, the module developer (Agentrickard) is very competent and helpful. Of course, knowing next to nothing about software, I may be completely off track.

#5

NancyDru - January 6, 2009 - 23:11

TI does use stored variables, but I don't know why Domain would mess with them. But I know nothing about the Domain packages.

#6

skizzo - January 7, 2009 - 09:28

taxonomy_image.module on line 144 says

    case 1: // Not greater than.
      if ($width && ($width < $image->width)) {
        $width_scale = $image->width / $width;
      }

No matter what I do in TI configuration (imagecache, original, etc..) I always end up at line 144 dividing by zero width. I installed the Devel module and found the Variable Editor with following readings. Does it sound consistent to you? If so, nothing is messing with variables. But then, what else is bringing me to line 144 ???

taxonomy_image_block_imagecache_preset s:18:"taxonomy_image_LNB"; 26
taxonomy_image_block_max_images s:1:"1"; 8
taxonomy_image_block_max_size s:8:"ORIGINAL"; 15
taxonomy_image_block_suppress i:0; 4
taxonomy_image_block_title s:7:"<none> "; 14
taxonomy_image_default s:0:""; 7
taxonomy_image_disable s:56:"Check this box to disable the display of content images."; 64
taxonomy_image_height s:0:""; 7
taxonomy_image_imagecache_preset s:18:"taxonomy_image_LNB"; 26
taxonomy_image_link_title s:1:"1"; 8
taxonomy_image_path s:17:"category_pictures"; 25
taxonomy_image_recursive s:1:"1"; 8
taxonomy_image_resize s:1:"0"; 8
taxonomy_image_width s:0:""; 7

I also tried the following configuration, to no avail. Now Width is 170 but it stil gives me "divide by zero" error and does not apply any resizing.
taxonomy_image_block_imagecache_preset s:18:"taxonomy_image_LNB"; 26
taxonomy_image_block_max_images s:1:"1"; 8
taxonomy_image_block_max_size s:8:"ORIGINAL"; 15
taxonomy_image_block_suppress i:0; 4
taxonomy_image_block_title s:7:"<none> "; 14
taxonomy_image_default s:0:""; 7
taxonomy_image_disable s:56:"Check this box to disable the display of content images."; 64
taxonomy_image_height s:3:"130"; 10
taxonomy_image_imagecache_preset s:18:"taxonomy_image_LNB"; 26
taxonomy_image_link_title s:1:"1"; 8
taxonomy_image_path s:17:"category_pictures"; 25
taxonomy_image_recursive s:1:"1"; 8
taxonomy_image_resize s:1:"1"; 8
taxonomy_image_width s:3:"170";  10

#7

skizzo - January 7, 2009 - 13:22

Just to be sure, I went back to 5.x-1.5 and the problem disappeared.
I am surprised that apparently I am the only one stumbling on it...

#8

NancyDru - January 7, 2009 - 23:01
Status:fixed» active

I reversed some code that looked backwards to me in a recent change. I had to resave my settings and then this went away. But your variables look right. Hmm...

#9

NancyDru - February 2, 2009 - 18:43
Status:active» postponed (maintainer needs more info)

Is this still happening with the latest -dev version? Have you cleared the TI cache?

#10

skizzo - February 2, 2009 - 21:02

I am now moving to D6, starting from scratch: glad to see that D6 TI is ready :-) and I will be trying it soon. So I can't say for sure about D5 dev, but I would assume that the division-by-zero error is not there, otherwise you would surely hear from other users. Maybe you can just close this issue. Thank you.

#11

NancyDru - February 2, 2009 - 23:33
Status:postponed (maintainer needs more info)» closed

Okie dokie.

#12

skizzo - February 5, 2009 - 15:21
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:closed» active

no way... :-(
I am now using D6 (brand new installation, new database, starting from scratch). Imagecache is disabled, TI Block enabled. TI resizing options disabled. Added a single taxonomy Image. Defined a block. Changed the block configuration (number of images=1 Maxsize ORIGINAL). On node display I still get the error. I would like to "clear" the block configuration, but I am not sure how to do it. I am not a developer, but I could use phpMyAdmin or Dev if walked through it.

    * warning: Division by zero in /var/www/drupal/sites/all/modules/taxonomy_image/taxonomy_image.module on line 145.
    * warning: Division by zero in /var/www/drupal/sites/all/modules/taxonomy_image/taxonomy_image.module on line 148.

#13

NancyDru - February 12, 2009 - 18:18

Aha, I just duplicated this - now I can fix it.

#14

NancyDru - February 12, 2009 - 18:38
Status:active» fixed

Fix committed on both branches. I guess I never thought to test a block with no resizing at all.

#15

System Message - February 26, 2009 - 18:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.