Unbelievable plugin :-) Here's a patch for targeting the links
| Project: | Cooliris (PicLens formerly) |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Thanks for bringing this fun thing to my attention. I just noticed the project by accident in the forum and thought "What's all this then?"
... I've been grinning all day. It's going to make my next presentation drop-dead-georgeous.
Anyway. A little investigation found that the link target is the same as the full-sized image. I want folk to be able to find more info about the image they are viewing, so the piclens link (a very small one) could be used in the proper way.
Here's how I tweaked it. I think it's proper for the NODE not the JPG to be the landing spot for image browsers, but I've left the default behaviour alone, just added this as an option.
--- piclens.module 13 Apr 2008 13:30:17 -0000 1.1.2.1
+++ piclens.module 14 Apr 2008 09:17:45 -0000
@@ -119,6 +119,14 @@ function piclens_admin_settings() {
'#default_value' => variable_get('piclens_image_gallery_link', 0),
);
}
+
+ $form['piclens_image_link_to'] = array(
+ '#type' => 'radios',
+ '#title' => t('Link PicLens preview back to:'),
+ '#options' => array('image' => 'Direct image link', 'node' => 'Drupal image node page'),
+ '#default_value' => variable_get('piclens_image_link_to', 'image'),
+ );
+
return system_settings_form($form);
}
else {
@@ -194,7 +202,7 @@ function piclens_rss($items) {
$output = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss">
<channel>
- '. $items .'
+ '. $items .'
</channel>
</rss>';
@@ -265,6 +273,9 @@ function piclens_image_gallery_images($t
'thumbnail' => $GLOBALS['base_url'] .'/'. $node->images['thumbnail'],
'content' => $GLOBALS['base_url'] .'/'. $node->images[$content],
);
+ if(variable_get('piclens_image_link_to', 'image') == 'node') {
+ $item['link'] = url('node/'. $node->nid, NULL, NULL, TRUE);
+ }
$items .= piclens_format_item($item);
}
return $items;PS. Consider using Drupal url() (as illustrated above) instead of string concats when making links. It may help protect against vagaries like private files and unclean URLs.
| Attachment | Size |
|---|---|
| piclens_choose_link_target.diff | 1.53 KB |

#1
Mmm cool feature and request, I'll commit this as soon as I can (probably tonight, I'm at work now) (also for 6).
I'll also use url() function instead (I forgot about the absolute = true option), thanks for pointing that out!
#2
Commited to drupal 5 & 6 branch.
Thanks!