Kludge to replace WebMagick's javascript thumbnail index with existing no-javascript one.
webmagick's generated thumbnail index contains javascript which breaks badly under reasonably secure Mozilla settings. Using this wrapper allows you to view the resulting thumbnail indeces without compromising you browser configuration.
Yeah, this *is* a marginal post to snippets. The criteria appear to be clever, useful, and hard to write, so I'm batting 300. 8^P
#!/usr/bin/perl -w
# webmagick.pl
# pod at tail
$|++;
use strict;
use Cwd;
my $dmw = 'index.html';
my $wmBin = '/usr/bin/webmagick';
my $wmSyn = '--forcehtml --forcecache --forcemontage';
my $wmPaths = '--rootpath /var/www/ --iconpath doc/webmagick/icons/';
my $wmColors = '--colorback white --thumbbackground white';
my $baseDir = '/var/www/Graphics';
my @dirs = (
'Christian',
'Ico',
'Icons',
'Images',
'Tech',
);
for(@dirs){
-d "$baseDir/$_" or next;
chdir "$baseDir/$_" or next;
unlink $dmw if -w $dmw;
system("$wmBin $wmSyn $wmPaths $wmColors") and warn $!;
unlink $dmw if -w $dmw;
symlink '.index1.html', 'index.html' or warn $!;
}
=head1 TITLE
wm.pl
=head1 DESCRIPTION
Wrapper for webmagick. Webmagick creates thumbnails and
markup to easily browse said thumbnails
Sadly, Debian's current webmagick uses JavaScript in it's
markup. My Mozilla settings don't seem to like that. So
this ditty runs webmagick against a configured list of image
directories, then unlinks the javascripted index.html, and
symlinks index.html from a non-JS thumbnail montage page.
Yes, I know it's a brittle kludge. But I don't care because
it's *my* kludge. ;^)
Oh yeah, and as a kludge, it doesn't support recursing
directories.
P.S. $dmw stands for Dead Man Walking. I considered $ejs
for Evil Java Script.
=head1 AUTHOR
ybiC
=head1 UPDATES
2002-04-20 20:55 CDT
Post to PerlMonks
Initial working code
=cut
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.