#!/usr/bin/perl
# viewjpg.pl
# ----------
require 'vxcgi.pl';
require 'gallery.pl';
$tx1 = "#5050A0";
cgi_vars(); # $coll = collection directory name; $file = name of JPG file; $fs = 1 if full-size
# $coll='ScreenThemes_Posters';
# $file='poster_arti001.jpg';
# NEW: Always show the full-size version right away.
$fs=1;
if (!$coll || !$file) { cgi_redirect("http://www.screenthemes.com/gallery/"); }
$coll =~ tr/ /+/;
$file =~ tr/ /+/;
$packid = ($coll =~ /^ScreenThemes_Posters$/i) ? lc(substr($file, 7, 7)) : "";
require "$visionx_com/vxsecure/st/packinfo.pl" if $packid;
require "$coll/data.pl" if -e "$coll/data.pl";
cgi_header();
# Write to data file if the user is getting the full-screen image.
if ($fs)
{
my ($sec, $min, $hr, $day, $mo, $yr, $dow, $doy, $isdst) = localtime();
my ($y, $m, $d) = ($yr + 1900, $mo + 1, $day);
my $datafile = sprintf("_data_/%04d_%02d_%s.dat", $y, $m, $coll);
my $datetime = sprintf("%02d/%02d %02d:%02d", $m, $d, $hr, $min);
my $filetitle = $file;
$filetitle =~ s/\.jpg$//i;
$rawdata = "$ENV{'REMOTE_HOST'}";
$rawdata .= "\t$datetime";
$rawdata .= "\t$filetitle";
$rawdata .= "\n";
open (DATA, ">>$datafile");
print DATA "$rawdata";
close(DATA);
}
gallery_header(1, $fs);
print <<".";
.
center_begin();
show_image($file);
center_end();
gallery_footer(1, $fs);
#---------------------------------------------------------------------
sub center_begin
{
my $colltitle = $coll; $colltitle =~ tr/_/ /;
my $filetitle = $file; $filetitle =~ tr/_/ /; $filetitle =~ s/\.jpg$//i;
my ($w, $h) = split /,/, ($actual{$file} ? $actual{$file} : "1024,768");
my $who = ($who{$file} && $who{file} !~ /ScreenThemes/i) ? "
by $who{$file}" : "";
print <<".";
|
|
.
}
sub center_end
{
print <<".";
|
.
}
#---------------------------------------------------------------------
sub show_image
{
my $title;
if ($packid)
{
$title = $name{$packid};
}
else
{
$title = $file;
$title =~ tr/_/ /;
$title =~ s/\.jpg$//i;
}
my ($w, $h) = split /,/, ( $fs ? ($actual{$file} ? $actual{$file} : "1024,768") : ($medium{$file} ? $medium{$file} : "400,300") );
my $h2 = $h + 20;
my $jpg = $fs ? "$coll/$file" : "$coll/medium/$file";
my $txt = $fs ? "Right-click on this image and select \"Set as Wallpaper\" and/or \"Save Picture As\" to save it" : "Click on this image for the full-size version";
my $a1 = $fs ? "" : "";
my $a2 = $fs ? "" : "";
print <<".";
$txt $a1 $a2 $txt
View more free ScreenThemes posters
|
.
# print <<".";
#
# |
#
# |
#
# .
}