2 # Ikiwiki Apache::Gallery plugin
3 # Don Armstrong <don@donarmstrong.com> 2011/11/26
5 package IkiWiki::Plugin::agimg;
12 use URI::Escape qw(uri_escape_utf8);
13 use HTML::Entities qw(encode_entities);
16 hook(type => "getsetup", id => "agimg", call => \&getsetup);
17 hook(type => "checkconfig", id => "agimg", call => \&checkconfig);
18 hook(type => "preprocess", id => "agimg", call => \&preprocess);
22 return (plugin => {safe => 1,
26 agimgprefix => {type => "string",
27 example => "/gallery/",
28 description => "Base URI of Apache Gallery site",
37 if (! defined $config{agimgprefix}) {
38 $config{agimgprefix} = ""
44 my ($url) = $_[0] =~ /^(.+)$/; # anything is ok
45 my $complete_url = $config{agimgprefix}.$url; #encode_entities($config{agimgprefix} . $url);
46 return "<a href=\"$complete_url\"><img class=\"agimg\" src=\"${complete_url}?thumbonly\"></a>";