I have installed imagecache (6.x-2.0-beta10) and comments_upload (6.x-1.x-dev (2009-Dec-01). For one node type I am using 'image attachments on comments' with imagecache. But when viewing comments for that node type I am seeing uploaded images and not images from imagecache.

Problem is in comment_upload.module on line 361:

361: if (is_numeric($display_setting)) {
362:   $imagecache_preset = imagecache_preset($display_setting);
363:   $preset_name = $imagecache_preset['presetname'];
364: }

$display_setting is a string and can not be a number:

357: $display_setting = variable_get('comment_upload_images_'. $node->type, 'none');

Imagecache is storing presets like strings and not numbers (maybe it stored preset ids in some previous version and this code worked) but with latest version it is not working.

After removing that if (is_numeric($display_setting)) everything is working fine.

Comments

heine’s picture

Title: imagecache pictures are not shown when viewing comments » Compatability with ImageCache 6.x-2.x
Category: bug » feature
pivica’s picture

One little update, because we now have preset name it seems that code

362: $imagecache_preset = imagecache_preset($display_setting);
363: $preset_name = $imagecache_preset['presetname'];

is not needed anymore. I have tested next code

359: if ($display_setting != 'none') {
360:   $display_images = TRUE;
361:   $preset_name = $display_setting; 
362: }

and its working fine.

nestorconde’s picture

StatusFileSize
new638 bytes

The proposed correction in #2 worked for me. I attach the patch

Andrew44’s picture

Hi,

I think this is something to do with the problem I am having but I'm no expert, just learning.

I use comment uploads too. When I upload a comment I want to see a preview of the image and then click on it to have lightbox2 to expand the image out.

I applied the patch but when I do that I just see the name of the file and then when I click on that link it takes me to the image without opening it in lightbox.

In lightbox I went into custom handling and set the custom trigger class as

comment-upload-images

Why wont it work?

Thanks in advance,

Andrew

MafiaMoe’s picture

Go into Administer > Content Management > Content Types, and edit the Forum Post type. Under comments, change the 'Image attachments on comments:' to 'via imagecache thumbnail'.

That solves on issue, how to view it using lightbox2 is something I am still looking into (I have admittedly only been looking into this for a grand total of 10 minutes).

lupus78’s picture

I have a solution for lighbox:

1. copy the comment-upload-attachments.tpl.php file from the module folder into your themes folder.

2. edit the linke where the image is linked:

from this:

<a href="<?php print $image['url'] ?>"><?php print $image['image'] ?></a>

to this:

<a href="<?php print $image['url'] ?>" rel="lightbox"><?php print $image['image'] ?></a>
the_g_bomb’s picture

Status: Active » Reviewed & tested by the community

I just updated and noticed this issue, patch at #3 solves and lightbox solution at #6 works as well. It would be handy if there was only one issue to deal with here, but as the patch needs to get in to fix this issue I am marking RBTC.