summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-06-06 11:02:34 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-06-06 11:02:34 +0200
commitfe923497feba3d9f276ca490967b91382e2dbfd8 (patch)
tree6a9fba42959fab3fa191df46c01f91345c0a154a
parentea1438404b04430c78f4a115a97a0be887a9a8a0 (diff)
downloadgenerate_gallery-fe923497feba3d9f276ca490967b91382e2dbfd8.tar.gz
generate_gallery-fe923497feba3d9f276ca490967b91382e2dbfd8.tar.xz
Add --basepath option
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xgenerate_gallery.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/generate_gallery.pl b/generate_gallery.pl
index 978857d..8373fd2 100755
--- a/generate_gallery.pl
+++ b/generate_gallery.pl
@@ -17,8 +17,9 @@ my %opts = ();
$opts{template} = "$templatedir/template.html";
$opts{thumbnailsize} = 200;
+$opts{basepath} = "";
-GetOptions(\%opts, "exif|e", "verbose|v", "help|h", "filenamedesc", "template=s", "thumbnailsize|s=i", "htmlonly") or pod2usage(2);
+GetOptions(\%opts, "exif|e", "verbose|v", "help|h", "filenamedesc", "template=s", "thumbnailsize|s=i", "htmlonly", "basepath=s") or pod2usage(2);
pod2usage(0) if $opts{help};
pod2usage(-verbose => 0) if (@ARGV== 0);
@@ -77,8 +78,8 @@ for my $dir (@ARGV) {
$html .= "<div class=\"thumbnail\">\n";
$html .= "<a rel=\"images\" class=\"thumbnail\" ";
$html .= "title=\"$description\" " if $description;
- $html .= "href=\"$file\">\n";
- $html .= "<img class=\"thumbnail\" alt=\"\" src=\"thumbs/$file\" />\n";
+ $html .= "href=\"$opts{basepath}$file\">\n";
+ $html .= "<img class=\"thumbnail\" alt=\"\" src=\"$opts{basepath}thumbs/$file\" />\n";
$html .= "</a>\n</div>\n";
}
open TEMPLATE, "<", "$opts{template}";
@@ -115,6 +116,7 @@ generate_gallery.pl [options] <directory ...>
--htmlonly don't copy the fancybox directory
--thumbnailsize, -s <size> change size of the thumbnails in pixels
(default: 200)
+ --basepath <string> Prepend this path to the URLs in the output HTML
=head1 DESCRIPTION
@@ -156,6 +158,10 @@ Only generate thumbnails and the html file. This disables copying of fancybox.
Change the size of the generated thumbnails in pixels. Default: 200
+=item B<--basepath> <string>
+
+Prepend this path to the URLs in the output HTML. The path should probably end with a /.
+
=back
=cut