#!/usr/bin/perl
# --------------------------------- #
# SOPHIAKNOWS #
# --------------------------------- #
# PERL: IMAGE OF THE DAY #
# --------------------------------- #
# Created: 2001-12-02 #
# Issued: 2001-12-02 #
# Modified: 2004-12-15 #
# Copyright (c) 2004 #
# A.R. Pisarra, SophiaKnows #
# --------------------------------- #
# --------------------------------- #
# PATH TO FULL IMAGES
$bigpath="big/";
# PATH TO THUMBNAILS
$thumbpath="thumbs/";
# INCLUDE/INVOKE PARSEFORM
require "parseform.pl";
&ParseForm;
# SET START POINT
$start=(($formdata{'start'})?$formdata{'start'}:0);
# INIT DAILY IMAGES
for($i=0;$i<7;$i++) {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdt)=localtime(time-(($start+$i)*86400);
$daily_images[$i]=($year+1900)."-".AppendZero($mon+1)."-".AppendZero($mday).".jpg";
}
# BUILD THUMBS
for($x=0;$x<7;$x++) {
$thumbs.="<p><a href=\"javascript:SwapImage('baseimage','";
$thumbs.=$bigpath."".$daily_images[$x];
$thumbs.="')\">";
$thumbs.="<img src=\"".$thumbpath.$daily_images[$x]."\">";
$thumbs.="</a></p>\n";
}
# APPEND LEADING ZEROS
sub AppendZero {
return (($_[0]<10)? "0"."$_[0]":$_[0]);
}
# PRINT PAGE
print "Content-type: text/html\n\n";
print "<title>PHP: Daily Image</title>\n";
print "<script type='text/javascript'>\n";
print "function SwapImage(n,s) {\n";
print "\tdocument.images[n].src=s;\n";
print "\t}\n";
print "</script>\n";
print "<body>\n";
print "<center>\n";
print "<font face=verdana,geneva,arial>\n";
print "<p>< <a href=pod.php?start=0>This Week</a> | Prior Weeks:\n";
print "\t<a href=?start=7>1</a>\n";
print "\t<a href=?start=14>2</a>\n";
print "\t<a href=?start=21>3</a>\n";
print "\t<a href=?start=28>4</a>\n";
print "| <a href=month.pl>Archive</a>\n";
print ">\n";
print "<br /><br />\n";
print "<table width=100%><tr>\n";
print "<td width=200>\n";
print "$thumbs\n";
print "</td>\n";
print "<td width=* align=center>\n";
print "<img src=\"big/$daily_images[0]\" name=baseimage">\n";
print "</td>\n";
print "</tr></table>\n";
print "</body>\n";
1;