#!/usr/bin/perl -w # http://riverdrift.com/ 2007 # Install in any directory with images # name whatever.pl and chomod to 755 # Edit variables below as you wish ########################################## # title $title='Backgrounds'; # header $header='Favorite Backs'; # thumbnail size $tsz='70'; # table colums $cols='8'; # background color $bgc='#336666'; # text color $txtclr='#99ff66'; # link color $lnkclr='#66ffcc'; # vlink color $vlnkclr='#66cccc'; # font size $fntsze='12pt'; ########################################## $root = $ENV{'SERVER_NAME'}; $script = $ENV{'SCRIPT_NAME'}; use CGI qw(param); $file = param('file'); print "Content-type:text/html\n\n"; if ($file) { &do_stuff; } else { &disply_img; } sub disply_img { $direct = `dirname $script`; chomp($direct); print qq~ $title
XtGem Forum catalog

$header

\n~; @Files = `ls $dir`; $i=0; foreach (sort @Files) { chomp; &file_size; use Image::Size; ($x, $y) = imgsize($_); { $ht = $y;} if (m/(gif|jpg|jpeg|png|swf)$/i) { print qq~~; $i++; if($i==$cols) { print ""; $i=0; } } } print qq~
$_
Info  Tile
~; exit; } sub do_stuff { $direct = `dirname $script`; print qq~ $title

$file

~; exit; } sub file_size { $size = (-s); $kb = 1024; $mb = $kb * $kb; if ($size > $mb) { $size = sprintf('%.2f', $size / $mb) . ' mb'; } elsif ($size > $kb) { $size = sprintf('%.1f', $size / $kb) . ' kb'; } else { $size .= ' bytes'; } }