diff options
-rw-r--r-- | docs/extending_tidypics.txt | 1 | ||||
-rw-r--r-- | views/default/object/image.php | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/docs/extending_tidypics.txt b/docs/extending_tidypics.txt index 916cfa4ee..58fba6721 100644 --- a/docs/extending_tidypics.txt +++ b/docs/extending_tidypics.txt @@ -28,6 +28,7 @@ different css elements and where they are used. 'tp_watermark', 'gd'
'tp_watermark', 'imagick'
'tp_watermark', 'imagemagick'
+3. image link: 'tp_image_link', 'image' - return false for no link or a url otherwise - params passed to this will porbably change in 1.7
*** IMAGE MENU EXTENSIONS ***
diff --git a/views/default/object/image.php b/views/default/object/image.php index ae652fdfd..01beb25f6 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -146,15 +146,24 @@ </div> <div id="tidypics_image_wrapper"> <?php - if (get_plugin_setting('download_link', 'tidypics') != "disabled") { + // this code controls whether the photo is a hyperlink or not and what it links to + $image_link = false; + if (get_plugin_setting('download_link', 'tidypics') != "disabled") { + // admin allows downloads so default to download link $ts = time(); $token = generate_action_token($ts); - $download_url = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&view=inline&__elgg_token={$token}&__elgg_ts={$ts}"; - echo "<a href=\"{$download_url}\" title=\"{$title}\"><img id=\"tidypics_image\" src=\"{$vars['url']}mod/tidypics/thumbnail.php?file_guid={$image_guid}&size=large\" alt=\"{$title}\" /></a>"; + $image_link = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&view=inline&__elgg_token={$token}&__elgg_ts={$ts}"; + } + // does any plugin want to override the link + $image_link = trigger_plugin_hook('tp_image_link', 'image', $image, $image_link); + // add link if set + if ($image_link) { + echo "<a href=\"{$image_link}\" title=\"{$title}\"><img id=\"tidypics_image\" src=\"{$vars['url']}mod/tidypics/thumbnail.php?file_guid={$image_guid}&size=large\" alt=\"{$title}\" /></a>"; } else { + // no link for this image echo "<img id=\"tidypics_image\" src=\"{$vars['url']}mod/tidypics/thumbnail.php?file_guid={$image_guid}&size=large\" alt=\"{$title}\" />"; } - ?> + ?> <div class="clearfloat"></div> </div> <?php |