diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-10-03 18:53:57 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-10-03 18:53:57 +0000 |
commit | a587ad4ed1867743ea9e698f98a156f4f763e86a (patch) | |
tree | f94a1d3372902d8e33927c5ca97d7384ddd4432a /views/default/object/image.php | |
parent | bdf9f7fe79f5c8077d20dbb1029903ed90e77d36 (diff) | |
download | elgg-a587ad4ed1867743ea9e698f98a156f4f763e86a.tar.gz elgg-a587ad4ed1867743ea9e698f98a156f4f763e86a.tar.bz2 |
added plugin hook for image links - allows people to do creative things
Diffstat (limited to 'views/default/object/image.php')
-rw-r--r-- | views/default/object/image.php | 17 |
1 files changed, 13 insertions, 4 deletions
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 |