| [reply] |
In general, you'd want to look at the documentation for CGI.pm, and maybe CGI::Application.
If you want more specific help, you'd have to describe what you want, and what you've tried1 and where you got stuck in more detail.
1 - This is not really a site to get full-blown programs written for you - but most people will be glad to help you out when you get stuck with writing your program. Also, without that information, it's really hard to figure out what "level" of information you want/need.
| [reply] |
Here is a simple little script to give you some ideas. It dosn't do exactly what you want, but it will make thumbnails, and some html in frames to display some images. Just run it in a directory of jpgs, then open the index.htmlFor your purposes, you will want to have a form
on your first page to get the number of pictures wanted, then just print out the next page with as many links to thumbnails(or full photos) as requested. Anyways, read ovid's tutorial, then look at the code below, and experiment a bit...you will get the idea. I am creating "static" pages here, but after reading Ovid's tutorial, you should be able to generate "dynamic pages".
#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;
use Cwd;
#watch the width of your picture names
#they can widen the table cells if too long
umask 0022;
my $image = Image::Magick->new;
my $count = 0;
my $dir = cwd;
open(HEADER,">header.html");
print HEADER<<End_Header;
<html>
<BODY Text="#99CCFF" BGCOLOR="#000000">
<center><h1>Thumbnails for $dir</h1></center>
</body>
</html>
End_Header
close HEADER;
open(INDEX,">index.html");
print INDEX<<End_Index;
<html>
<head>
<TITLE>Thumbnails</TITLE>
<link rel="icon" href="favicon.ico">
</head>
<frameset rows="70,*" border="0">
<frame name="header" src="header.html" marginwidth="0" marginheight="
+0" scrolling="off" frameborder="0">
<frameset cols="130,*" border="0">
<frame name="left" src="left.html" marginwidth="5" marginheight="5
+" scrolling="yes" frameborder="5">
<frame name="main" src="main.html" marginwidth="5" marginheight="5
+" scrolling="yes" frameborder="5">
</frameset>
</frameset>
</html>
End_Index
close INDEX;
open(MAIN,">main.html");
print MAIN<<End_Main;
<html>
<BODY TEXT="#FFCCCC" BGCOLOR="#000000">
<center><h1>Click thumbnails at left to view</h1></center>
</body>
</html>
End_Main
close MAIN;
open(OUT,">left.html");
print OUT<<End_Header;
<html>
<body>
<table align=left bgcolor=9999CC border=2 cellpadding=2 cellspacing=2>
<tr>
End_Header
my @pics= <*.jpg>;
foreach my $pic (@pics){
$count++;
my ($picbasename) = $pic =~ /^(.*).jpg$/;
my $ok;
$ok = $image->Read($pic) and warn ($ok);
my ($w,$h)= $image->Get('columns','height');
my $thumb = $picbasename . '-t.jpg';
$ok = $image->Scale(geometry => '100x100')and warn ($ok);
$ok = $image->Write($thumb)and warn ($ok);
my ($tw,$th)= $image->Get('columns','height');
my $picoptions= $w.'x'.$h.'x'.$tw.'x'.$th;
print "$pic\t$picoptions\n";
undef @$image;
print OUT<<EOTR;
<td align=center><a href="$pic" target=main HEIGHT=$h WIDTH=$w alt="[
+$pic]"><img alt= [$pic-thumbnail] src=$thumb height=$th width=$tw></a
+><br>$pic</td>
EOTR
if($count == 1){print OUT "</tr><tr>"; $count = 0};
}
print OUT<<EOHTML;
</tr>
</table>
</body>
</html>
EOHTML
close OUT;
I'm not really a human, but I play one on earth.
flash japh
| [reply] [d/l] |
I think I know what do you want, you can implement this but this seems to be the starting point.
#!/perl/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;
use strict;
use CGI;
my $got_img=param('myimage');
my $count;
print header();
print "test<br>";
print "<form action=check.pl\n";
print "<br><input type=checkbox name=myimage value=1>1<br>\n";
print "<input type=checkbox name=myimage value=2>2<br>\n";
print "<input type=checkbox name=myimage value=3>3<br>\n";
print "<input type=checkbox name=myimage value=4>4<br>\n";
print "<input type=checkbox name=myimage value=5>5<br>\n";
print "<input type=submit value=submit><br>\n";
print "** $got_img **<br>";
for ($count=0; $count<$got_img; $count++)
{
print "<b>$got_img</b> \n";
}
Good luck! | [reply] [d/l] |