View Single Post
Old 10-11-2007, 11:05 PM  
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Here. I'm bored, so I wrote a very trivial one for you. This isn't pretty
simple, but it'll work with any version of PHP4 and PHP5 with no problems.

If called normally, it will use the day of the year as the picture of the day, prefixing zeros as required for 3 numbers (001.jpg, 010.jpg, 111.jpg).

If you set "$rand=TRUE;" it will pick randomly between pictures 001.jpg to 365.jpg. If this file is missing, it will attempt to output "missing.jpg".

Code:
<?php
// DumbPic Script by GrouchyAdmin. <[email protected]>.
// You are free to use this code, but please leave this notice
// in place.
$rand=FALSE;
$dayNow=sprintf("03d", date("z")) . ".jpg";
header("Content-type: image/jpeg");
if ($rand)
$dayNow = sprintf("%03d", rand(1,365)) . ".jpg";
  header("Content-type: image/jpeg");
if (file_exists("$dayNow")) {
 @readfile("$dayNow");
} else {
 @readfile("missing.jpg");
}
?>
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote