|
Posted by Andy on 11/11/06 10:32
"password" <fatpipe@epiptaf.com> wrote in message
news:ePmdnesDuJN_GcnYRVnyiA@eclipse.net.uk...
> hello, i am using an automatic image rotator (php) which rotates images on
> refresh or everytime a page is accessed and i was wondering if it is
> possible to make the image change on a daily basis instead. ive been
> hunting
> the net but dont seem to be able to find a script that would do this.
>
> i am assuming it is possible but my knowledge of php is very limited.
>
> any help or pointers would be gratefully received and acknowledged.
>
> tia.
>
>
>
This is index.php:
<?
echo "
<center>
DailyPic
<BR><BR>
This is a Simple script to display a daily image, if no image exists it will
display a default image.
</center>
<BR>
";
include('potd.php');
?>
this is potd.php:
<?
#########################################################
# DailyPic #
#########################################################
# #
# Created by: http://www.free-php.net #
# #
# This script and all included functions, images, #
# and documentation are copyright 2003 #
# free-php.net (http://free-php.net) unless #
# otherwise stated in the module. #
# #
# Any copying, distribution, modification with #
# intent to distribute as new code will result #
# in immediate loss of your rights to use this #
# program as well as possible legal action. #
# #
# #
#########################################################
// Modify the Following Variables to fit your Website.
// To use simply include potd.php within any php page with the include
function.
// For your images you must name them according to date 2003-12-01.jpg would
be december 1 2003 image.
$date = date("Y-m-d");
// URL to Fullsize Images.
$image_url = "http://www.free-php.net/demo/DailyPic/photos/";
// Path to Fullsize Images
$image_dir =
"/home/www/codemunkyx/www/www.free-php.net/htdocs/demo/DailyPic/photos/";
// URL to Thumbnail Images.
$thumb_url = "http://www.free-php.net/demo/DailyPic/photos/thumbs/";
// Path to Thumbnail Images.
$thumb_dir =
"/home/www/codemunkyx/www/www.free-php.net/htdocs/demo/DailyPic/photos/thumbs/";
// Default Thumbnail if no image is available for Today
$default = "http://www.free-php.net/demo/DailyPic/photos/default.jpg";
// Image Extension for Your Pics
$ext = ".jpg";
$photo = "$image_dir/$date" . $ext . "";
if (file_exists ( $photo)){
echo "
<div align=center>
<A HREF='$image_url/$date" . $ext . "' target='_blank'><IMG
SRC='$thumb_url/$date" . $ext . "' border=0></A><BR>
<A HREF='http://www.free-php.net' target='_blank'><font size=2>powered
by: Free-PHP.net</FONT></A><BR>
</DIV>
";
} else {
echo "
<div align=center>
<IMG SRC='$default' border=0><BR>
<A HREF='http://www.free-php.net' target='_blank'><font size=2>powered
by: Free-PHP.net</FONT></A><BR>
</DIV>
";
}
?>
[Back to original message]
|