[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: Multiple outputs, one input
- From: Nobuyuki Tsuchimura <nospam@thanx>
- Date: Sat, 23 Dec 2000 16:48:49 +0900 (JST)
Hi, Mak
Subject: Multiple outputs, one input
Date: Sat, 23 Dec 2000 00:47:56 -0500 (EST)
> I would want to be able to use evangelion.wml to generate:
> index.html (thumbnail pages)
> index-2.html
> index-3.html
> index-4.html
> index-5.html
> image-1.html (full-sized image pages)
> image-2.html
> ...
> image-30.html
I'm not sure wml can generate many files,
but I think perl script can do.
I made a script which generate htmls from jpgs.
I use more complex version.
ex. http://www.nn.iij4u.or.jp/~tutimura/pool2000/ (sorry Japanese)
Regards,
-- Nobuyuki Tsuchimura
#!/usr/bin/perl -w
# generate thumbnails, htmls, and index.html from jpgs in current directory.
# using perl, ls, grep, sed, wml, cjpeg, djpeg, pnmscale.
$wml = "wml | sed -e 's/ SUMMARY=\"\"//ig'";
$head = <<EOS;
#use wml::std::page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<PAGE BGCOLOR="#000000" TEXT="#CCCCCC" LINK="#AAAAFF" VLINK="#00FFFF" ALINK="#FF0000">
EOS
# enumerate jpgs in $title[]
open( IN, "ls *.jpg | grep -v S.jpg | sed -e s/.jpg//g |" );
@title = <IN>; # ^^^ remove thumbnails
close(IN);
chomp @title;
# generate one html and one thumbnail per jpg
for ( $i=0; $title[$i]; $i++ ) {
$html = $title[$i] . ".html";
$large = $title[$i] . ".jpg";
$small = $title[$i] . "S.jpg";
print "writting $html \n";
open( HTML, "| $wml > $html" );
print HTML <<EOS;
$head
<HEAD><TITLE>$large</TITLE></HEAD>
<CENTER><IMG SRC="$large"></CENTER>
EOS
close(HTML);
system( "djpeg $large | pnmscale 0.22 | cjpeg > $small" );
}
# generate index.html
open( HTML, "| $wml > index.html" );
print HTML <<EOS;
$head
<HEAD><TITLE>index page</TITLE></HEAD>
<H1 ALIGN="CENTER">index page</H1>
<CENTER>
EOS
for ( $i=0; $title[$i]; $i++ ) {
$html = $title[$i] . ".html";
$small = $title[$i] . "S.jpg";
print HTML "<TABLE BORDER=1><TR ALIGN=CENTER>\n" if ( $i % 4 == 0 );
print HTML
"<TD><A HREF=\"$html\"><IMG SRC=\"$small\" ALT=\"$small\"></A>\n";
print HTML "</TR></TABLE><BR>\n" if ( $i % 4 == 3 || !$title[$i+1] );
}
print HTML "</CENTER>\n";
close(HTML);