From a587ad4ed1867743ea9e698f98a156f4f763e86a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 3 Oct 2009 18:53:57 +0000 Subject: added plugin hook for image links - allows people to do creative things --- docs/extending_tidypics.txt | 1 + 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 @@
\"{$title}\""; + $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 "\"{$title}\""; } else { + // no link for this image echo "\"{$title}\""; } - ?> + ?>