Hello,
I'm uncertain where this problem is coming from, I thought it was with imagecache, but it seems to only occur when using Lightbox to display images.

I noticed it after updating my local test server (mac) and stage server (linux) I updated to Drupal 5.10 and upgraded 'update status' and 'nodewords' modules.

The Problem
When I set the display options for an image_field on a node to use the Lightbox2: Preset 1 -> Preset 2 for full node display my imagecache folder gets a new image in the preset_2 folder for every time the popup image is viewed.

I have tried using different content types and it still happens, It seems I can only use Lightbox2: Preset 1 -> Original to avoid this happening, but that means the user is responsible for posting decent sized images.

I have also looked at other local sites that use Lightbox & imagecache, the same seems to be happening to them too. I'm unwilling to attempt upgrading my live sites with this happening locally. It doesn't seem to be happening on the actual live sites.

This is the link to the second (enlarged) image in the browser.
example.com/sites/default/files/imagecache/News_fullsize/news_images/HTS_COVER.jpg
I believe it should be like the following…
example.com/files/imagecache/News_fullsize/sites/default/files/news_images/HTS_COVER.jpg <<-- is this correct?

Here is the code that Lightbox generates for the imagefield.
<div class="view-field-image">
<a rel="lightbox[field_news_image][HuntRasher.jpg<br /><br /><a href="/news/07-08-2008/happy-birthday-the-beano">View Image Details</a>]" href="http://example.com/sites/default/files/imagecache/News_fullsize/news_ima...
<img title="HuntRasher.jpg" alt="" src="http://example.com/sites/default/files/imagecache/News_preview_square/si...
</a>
</div>

It seems to be trying to use a path that imagecache can't find & so it creates another 'cache' image.

I have reverted everything to the server version, but it is still occuring ! i think I'll try from clean install of a test site.
Any other suggestions ?

PS I have the following modules installed (with too many to list)
CCK 5.x-1.7
Views 5.x-1.6
Lightbox2 5.x-2.8
Imagecache 5.x-1.6
Pathauto 5.x-2.3
Token 5.x-1.11
Transliteration 5.x-2.0

I also posted about this issue here http://drupal.org/node/297476, but I think Lightbox may be the cause…

Comments

stella’s picture

I can't reproduce this issue. Here's what I've done.

I've created a cck content type called "myimage" and I've added an imagefield to it. I configured the imagefield widget settings so that the "image path" was blank. I set up an imagecache derivative called "thumbnail". I configured the "display options" for this field so that it just displayed the "thumbnail" sized image in the node - no link, no lightbox, etc, just the normal image display option provided by imagecache.

I then created a node and the thumbnail image was created at http://mydomain.com/files/sites/mydomain.com/imagecache/thumbnail/ When I changed the display option to "Lightbox2: thumbnail -> thumbnail", the same image thumbnail was used and no other file was created.

Later I switched the display option back to just "thumbnail" and changed the "image path" config option in the imagefield settings to "images". I then viewed the node again and a thumbnail image at http://mydomain.com/files/sites/mydomain.com/imagecache/thumbnail/images/ was created. Again I changed to the "Lightbox2: thumbnail -> thumbnail" display option, viewed the image in the lightbox and no additional file was created.

drew reece’s picture

Thanks stella,
A couple of things may be different.

For the imagefield widget, image path needs to be named in my case its news_images.
I use 2 different Imagecache presets. So that the node display options use 'Lightbox2: News_preview_square -> News_fullsize'.

When viewing the enlarged image I get the duplicate files in the sites/default/files/imagecache/News_fullsize/sites/default/files/news_images/ folder.

It happens with files that have no spaces or other non-alpha chars, so I don't think it's transliteration issues?

Thanks,
D

drew reece’s picture

Some more info.

I have made a new install of drupal 5.10 set up a virtual host and installed the following modules…
admin_menu-5.x-2.6
auto_nodetitle-5.x-1.1
cck-5.x-1.7
imagecache-5.x-1.6
imagefield-5.x-2.1
jquery_update-5.x-1.0
lightbox2-5.x-2.8
nodewords-5.x-1.12
pathauto-5.x-2.3
token-5.x-1.11
transliteration-5.x-2.0
update_status-5.x-2.3
views-5.x-1.6

My image field is attached to the 'blog' type (should've mentioned that earlier).
The files path is sites/default/files with public files. I have clean urls enabled, and the machine I'm testing on is a Mac on 10.5.4 using
MySql 5.0.51a
PHP 5.2.6
GD bundled (2.0.34 compatible)
Apache/2.2.8

2 ImageCache (IC) presets called lil & big
When I set the node display options to use 'Lightbox2: lil -> big' I now get a lot of error messages and no enlarged image (broken link/ camera icon). The errors were hidden before since I had previously overridden the theme_imagecache in my template.tpl. I don't have this in the new test site. The test theme is Garland.

Errors:
warning: getimagesize(imagecache/lil/sites/default/files/newsimages/3air_displays.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /Users/dru/Sites/Imagecache-test/sites/all/modules/imagecache/imagecache.module on line 208.

warning: filesize() [function.filesize]: stat failed for imagecache/lil/sites/default/files/newsimages/3air_displays.jpg in /Users/dru/Sites/Imagecache-test/sites/all/modules/imagecache/imagecache.module on line 209.

I also get this error after trying to view an enlarged image.
warning: Division by zero in /Users/dru/Sites/Imagecache-test/sites/all/modules/imagecache/imagecache.module on line 183.

Changing the imagefield path to just use no '-' has no affect, creating new IC presets without '_' also has no affect. It will only work for me when using original for the second image size.

Stella, please could you try the following?

Find the url to any imagecache generated file and open it in the browser, then remove the second 'sites/default/files' from the url & reload it. Check in the imagecache folder for duplicate images. If this happens to you too then this could be a security issue?

I'm starting to wonder if it must be something particular to my setup, I can't be the only person trying to use 2 IC presets for Lightbox2 ?

drew reece’s picture

Dagnabit, why does upgrading bite me on the ass so often?

Reverting to imagecache 5.x-1.5 removes the duplication of the images and the enlarged versions also work. It also 'fixes' other the local sites.

I'll try to figure out what is going on and post back to the imagecache issue queue.

stella’s picture

Perhaps you should upgrade to imagecache 5.x-2.x? I'm now using imagecache 2.x on my test site with no problems.

drew reece’s picture

@ Stella,
I can't use Imagecache 2.x because the live server is running PHP 4.x. I believe the image API requires PHP 5.x

Did you try removing the second 'sites/default/files' from the url & checking for duplicate images in the preset folder when using imagecache 5.x-1.6 ?

stella’s picture

I don't have a "sites/defaults/files/" (or similar) in my URLs, so I can't help you there. I've also running imagecache 2.x so it's quite likely that it would be completely different any how. I'd get support for this issue from the imagecache module if I were you.

However, I think you should upgrade to imagecache 2.x if possible. You also need to upgrade to PHP 5. PHP4 has reached end-of-life and is now no longer supported.

Cheers,
Stella

stella’s picture

Category: bug » support
Status: Active » Closed (fixed)

Closing issue, please feel free to re-open if you need further support.

Cheers,
Stella