Firstly - I an not 100% certain this is the fault of taxonomy_image, however that is the module that I've just installed and am trying to use - so I suspect it.

I get this in a drupal error message:


    * warning: Division by zero in /home/svn/codebase/drupal/ecommerce-5.8/modules/imagecache/imagecache.module on line 183.
    * warning: getimagesize(imagecache/splash-image/files/pictures/qcs-woman.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/svn/codebase/drupal/ecommerce-5.8/modules/imagecache/imagecache.module on line 208.
    * warning: filesize() [function.filesize]: stat failed for imagecache/splash-image/files/pictures/qcs-woman.jpg in /home/svn/codebase/drupal/ecommerce-5.8/modules/imagecache/imagecache.module on line 209.

I believe the directory it's meant to be looking in is under /files/imagecache not just /imagecache

Again I am not certain it is this module, I will be certain by tomorrow.

Comments

nancydru’s picture

Project: Taxonomy Image » ImageCache
Version: 5.x-1.3 » 5.x-1.x-dev

I have seen the "failed to open stream" message many times and don't understand it because the image IS usually displayed.

At any rate, TI has no control over which directory IC is using. Moving to the ImageCache queue. You probably need to check which version of that module you are using.

danielb’s picture

Version: 5.x-1.x-dev » 5.x-1.6
StatusFileSize
new27.46 KB
new41.52 KB

Imagecache 5.x-1.6
these errors all come from the function imagecache_cache() where the var $dst is "imagecache/splash-image/files/pictures/qcs-woman.jpg" which is a 404 path, the correct path is "/files/imagecache/splash-image/files/pictures/qcs-woman.jpg"

the var $dst is set like so:

$dst = 'imagecache/'. $preset .'/'. $src;

so I don't understand how it will ever look in the 'files' directory ?

Here is the best part though (and see my attached images for this), I am uploading a picture which is the exact same size as my preset, and imagecache appears to be screwing it up!

My settings for splash-image preset:

  • Scale 280x280 Outside dimension (weight 0)
  • Crop 280x280 center center (weight 2)

If I change 'center center' to 'top left' it works fine, but I don't want 'top left' (for when larger pictures are uploaded I want to chop off the sides).

nancydru’s picture

What I always do is to crop first, then scale. Something like Crop 500x500 center, then scale to 280x280. Well, actually, I usually use % for the cropping.

danielb’s picture

so if you upload an image that is 640x480 it will crop it to 500x480 and then scale it to 280x270 leaving 5px of black space at the top and bottom of the image. not good.

xurizaemon’s picture

Status: Active » Needs review
StatusFileSize
new1.12 KB

I'm seeing this issue too, after recently upgrading UberCart and ImageCache. I'm using UberCart-5.x-1.3 and ImageCache-5.x-1.6.

It seems to happen when the image is first referenced, and before it's cached. So you'll see the warning on the page AFTER the image is displayed.

Applying this page fixed the path issues for me: http://drupal.org/node/303903#comment-1014613

However, the div by zero was still there. I won't claim to fully understand the code around it, but I found that adding some defaults at line 168 of imagecache.module (5.x-1.6) fixed it for me.

Combined patch (incorporates the one linked above) attached, but would appreciate review.

xurizaemon’s picture

(duplicate post, oops)

danielb’s picture

Would like to confirm that reverting to version 1.5 fixed the division, path, and also my crop/scale problem.

My server admin says that the 1.6 version looks like a few lines of code have disappeared from it. Perhaps somebody has sat on the keyboard while the maintainer was in the toilet etc...

I would advise you to compare the 1.5 version for a patch, rather than trying to innovate.

shawn dearmond’s picture

I have this problem with:
Drupal 5.10
Imagecache 5.x-1.6
Imagefield 5.x-1.2-rc1
Views 5.x-1.6

It happened both on a views block and on a views page.

I applied the patch in http://drupal.org/node/309049#comment-1015097 and it didn't work for me. Nothing changed, even after I clicked "flush preset images".

I reverted to Imagecache 1.5 and that worked... though I'm not a big fan of moving backwards.

Has anyone tried upgrading to ImageCache 2.1 and ImageField 2.1?

treksler’s picture

can also confirm that 'center' keyword for cropping no longer works in 1.6
have moved back to 1.5 for now

nancydru’s picture

I gave up on trying to get the image path right, so I moved to 5.x-2.x and that problem went away.

bhill9270’s picture

from another forum, install php5-gd on the server.

fizk’s picture

Status: Needs review » Closed (won't fix)