#!/usr/bin/perl # #use warnings; use Image::Magick; use CGI::Pretty(':all'); use File::Glob qw(:globally :nocase); require('webnailer.conf'); my $version = "0.7"; my $i = 0; my @pix = glob("*.{JPG,GIF,PNG}"); my $q = new CGI; my $url = $q->url(-absolute=>'1'); my $width= $q->param('width') || $default_width_for_thumbnail; my $height= $q->param('height') || $default_height_for_thumbnail; my $pix_on_line = $q->param('pix') || $default_pix_on_line; my $offset = $q->param('offset') || 0; my $spec = $q->param('spec') || $pix_on_page; my $pix_on_page = $max_pix_on_page; my $paging = undef; $httpd_thumbs_dir =~ s/\/$//; $fs_thumbs_dir =~ s/\/$//; print header; if (($q->param('action')) && ($q->param('action') eq 'view') && ($q->param('file') > -1)) { my $index = $q->param('file'); my $file = $pix[$index]; my $image = new Image::Magick; $image->Read($file); my ($vheight,$vwidth); my ($owidth,$oheight) = $image->Get('width','height'); if (!(($vheight = $q->param('height')) && ($vwidth = $q->param('width')))) { ($vheight,$vwidth) = ($oheight,$owidth); } if ($file) { print "
[$file]\n" if ($spec); print " | |||
[$file]\n" if (!($spec));
print "
", $q->hidden(-name=>'action',-default=>'view'), $q->hidden(-name=>'file',-default=>$file), $q->textfield( -name=>'width', -default=>$owidth, -override=>1, -size=>4, -maxlength=>4), "x", $q->textfield( -name=>'height', -default=>$oheight, -override=>1, -size=>4, -maxlength=>4), br(), submit('view'), end_form; print "Generated by webnailer v $version\n"; print " |
\n"; print "$title | ||||||
\n";
print "
| ||||||
| ||||||
\n"; print "Generated by webnailer v $version\n"; print " |