2c2
< $ME = 'thumbindex v1.21B';
---
> $ME = 'thumbindex v1.2B';
4c4
< # this is still a program being developed... so bear with me.
---
> # this is still a program being developed... so bare with me.
8a9,12
> # this version added to by steev so it asks for captions and
> # pops up a javascript window with the pic and caption - june 99
> 
> use Term::ReadLine;   # this is for the interactive comment input
21,23d24
< #regexp for valid file types (returned by `file` and also extension)
< $VALID_TYPES = "(gif|jpe?g)";  #case gets ignored
< 
32c33
< $NO_NOTE = 1;  #set this if you want no note created (which is fine by me)
---
> $NO_NOTE = 0;  #set this if you want no note created (which is fine by me)
52,54d52
< #handle case where we have less images than $ACROSS
< $ACROSS = $#IMAGES + 1 if (($#IMAGES + 1) < $ACROSS);
< 
61a60
> $term = new Term::ReadLine 'Thumbindex';
64a64,67
>   $prompt = "caption for $image: ";
>   $_ = $term->readline($prompt);
>   push @captions, $_;
> 
116c119
<   my $i,$type,$cmd,$file,@f,$c,$name;
---
>   my ($i,$type,$cmd,$file,@f,$c,$name);
122a126
>     ###($name,$type) = ($`,$1) if ($i =~ /\.(.+?)$/);
124d127
<     #determine type of file... might vary by system!!
126,132d128
< 
<     #if not a valid type, try the extension of it (may be wrong!)
<     if ($type !~ /^$VALID_TYPES$/i) {
<       $type = $1 if ($i =~ /\.([^\/]+)$/);
<     }
<     print STDERR "BAD TYPE ($type)\n" if ($type !~ /^$VALID_TYPES$/i); #give up
< 
134a131,132
>     $name = $1 if ($i =~ /\/*([^\/]+)\.[^\/]*$/);  #pulls out name (no ext)
> 
137,138d134
<     } elsif ($type =~ /^jpe?g$/i) {
<       $cmd = "$BIN/djpeg -pnm";   #converting a jpeg
140c136
<       $cmd = $type . "topnm";     #may produce error, but what else can we do?
---
>       $cmd = "$BIN/djpeg -pnm";   #converting a jpeg
143,144d138
<     $name = $1 if ($i =~ /\/*([^\/]+)\.[^\/]*$/);  #pulls out name (no ext)
< 
153c147
<     $cmd = "$cmd '$i' | $BIN/pnmscale -width $SIZE -height $SIZE > $file";
---
>     $cmd = "$cmd $i | $BIN/pnmscale -width $SIZE -height $SIZE > $file";
161c155,156
<       $cmd = "echo \"BAD!\n$name\n$type\" | $BIN/pbmtext | $BIN/pnmscale -width $SIZE -height $SIZE > $file";
---
>       $cmd = "echo \"BAD!\n$name\n$type\" | $BIN/pbmtext | $BIN/pnmscale -width 
> $SIZE -height $SIZE > $file";
207c202
<   my $k,$r,$c,$f;
---
>   my ($k,$r,$c,$f);
217a213,215
>     # caption is found by looking in @captions
>     $cap = $captions[($r-1)*$ACROSS+($c-1)];
> 
221,223c219,223
<     $map .= sprintf("<area shape=\"rect\" coords=\"%d,%d,%d,%d\" href=\"%s\"
<       onMouseOver=\"window.status='%s'; return true\">\n",
<       $c-$SIZE,$r-$SIZE,$c,$r,$f,$INFO{$k});
---
>     $map .= sprintf(qq(<area shape="rect" coords="%d,%d,%d,%d"
>         href="%s" target="imageviewer"
>         onClick="viewimage('%s','%s'); return false"
>          onMouseOver="window.status='%s'; return true" >\n),
>         $c-$SIZE,$r-$SIZE,$c,$r,$f,$f,$cap,$INFO{$k});
236a237,245
> <script language="javascript">
> function viewimage (image,comment) {
>  	imageviewer = window.open('', 'imageviewer', "status=no,toolbar=no,titlebar=no,menubar=no,height=680,width=640,scrollbars,resizable");
>         imageviewer.document.open();
>         imageviewer.document.writeln("<title>" + comment + "</title><font face='helvetica,arial' size='4' ><b><center><img src=" + image + "><br>" + comment);
>         imageviewer.document.close();
> 
> }
> </script>
