Album
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
NAME => ucfirst($scripts[0]),
VERSION_FROM => "script/$scripts[0]",
($] >= 5.005) ?
( AUTHOR => 'Johan Vromans (jvromans@squirrel.nl)',
ABSTRACT => 'Creates HTML based photo albums' ) : (),
PREREQ_PM => { 'Getopt::Long' => 2.1,
'Image::Info' => 1.16,
'Image::Magick' => 6,
'File::Spec' => 0,
},
EXE_FILES => [ map { "script/$_" } @scripts ],
);
sub checkexec {
my ($exec) = @_;
my $path = findbin($exec);
if ( $path ) {
print STDERR ("\t Good, found $path\n");
return 1;
}
print STDERR ("\t Hmm. Couldn't find $exec in PATH\n");
script/album view on Meta::CPAN
setlocale(LC_COLLATE, $locale);
}
if ( defined($lib_common) ) {
$lib_common =~ s;/+$;;;
}
$lib_common ||= "";
}
sub load_info {
my %typemap = ( 'p' => T_JPG, 'm' => T_MPG, 'v' => T_VOICE );
# If an info has been supplied, it'd better exist.
if ( $info_file ) {
die("$info_file: $!\n") unless -s $info_file;
}
else {
# Try default.
$info_file = d_dest(DEFAULTS->{info});
unless ( -s $info_file ) {
my $add_new; $add_new++ if $import_dir;
script/album view on Meta::CPAN
$rotate = 90 * ($2 % 4);
}
elsif ( lc($1) eq 'i' ) {
$assc = fjoin(basename($file), $2);
unless ( -s $assc && -r _ ) {
warn("$file (info): $assc [$!]\n");
undef $assc;
}
}
elsif ( lc($1) eq 't' ) {
$type = $typemap{lc($2)}
or warn("$file (info): Illegal type: $2\n"), $err++;
}
$a = $3;
}
$el = new ImageInfo($file);
$el->type($type);
$el->description($a) if $a;
$el->tag($tag) if $tag;
$el->_rotation($rotate) if defined($rotate);
if ( $file =~ /^(.+)\.$movpat$/i ) {
script/album view on Meta::CPAN
}
sub load_info_journal {
my $err = shift;
my $fh = shift;
#### WARNING: EXPERIMENTAL ####
warn("parsing (journal mode)\n") if $trace;
my %typemap = ( 'p' => T_JPG, 'm' => T_MPG, 'v' => T_VOICE );
my $tag;
my $nexttag = 0;
my $annotation = "";
my $tags = 0;
my %dirs;
local($/) = ""; # para mode
while ( <$fh> ) {
chomp;
next if /^\s*#/;
script/album view on Meta::CPAN
$rotate = 90 * ($2 % 4);
}
elsif ( lc($1) eq 'i' ) {
$assc = fjoin(basename($file), $2);
unless ( -s $assc && -r _ ) {
warn("$file (info): $assc [$!]\n");
undef $assc;
}
}
elsif ( lc($1) eq 't' ) {
$type = $typemap{lc($2)}
or warn("$file (info): Illegal type: $2\n"), $err++;
}
$a = $3;
}
my $el = new ImageInfo($file);
$el->type($type);
$el->description($a) if $a;
$el->tag($tag) if $tag;
# $annotation ||= $a;
if ( $annotation ) {
script/album view on Meta::CPAN
my $dh = do { local *DH; *DH; };
opendir($dh, d_large())
or die("Cannot opendir " . d_large() . ": $!\n");
my @files = sort grep { !/^\./ && /$suffixpat$/ } readdir($dh);
closedir($dh);
foreach my $dir ( @subdirs ) {
opendir($dh, d_large($dir))
or die("Cannot opendir " . d_large($dir) . ": $!\n");
push(@files,
map { "$dir/$_" }
sort grep { !/^\./ && /$suffixpat$/ } readdir($dh));
closedir($dh);
}
while ( @files ) {
my $f = shift(@files);
next unless -f d_large($f);
my $el = new ImageInfo(d_large($f));
$el->type(T_JPG);
if ( $f =~ /^(.+)\.$picpat$/ ) {
script/album view on Meta::CPAN
</tr>
</table>
</body>
</html>
EOD
print STDERR ("\n") if $did;
}
sub process_fmt {
my ($fmt, %map) = @_;
$fmt =~ s/^(.*?)\$(\w+)\b/$1.indent($map{$2}, length($1))/gme;
$fmt;
}
################ Helpers for Image/Index/Journal pages ################
sub jscript {
my (%nav) = @_;
my $next = $nav{next};
my $prev = $nav{prev};
my $up = $nav{up};
script/album view on Meta::CPAN
$cc .= heredoc(<<" EOD", 16);
<td align='center' valign='bottom'>
<table class='inner'>
<tr>
<td align='center'>
<a href='$base'$target>@{[img($img, alt => "[Click for bigger image]", border => 0)]}</a>
</td>
</tr>
<tr>
<td align='center'>
<p class='ft'>@{[join($br, map { $capfun{$_}->($el) } split(//, $caption))]}</p>
</td>
</tr>
</table>
</td>
EOD
}
else {
$cc .= " <td width='$thumb'> </td>\n";
}
}
( run in 0.230 second using v1.01-cache-2.11-cpan-65fba6d93b7 )