Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Display a different image for each day of the week

Sun Oct 26, 2008 6:12 pm

This PHP script will get the day of the week from the server date and then display an image (jpg or gif) to match.

Code:
<?php
/**
 * Change the name of the image folder
 *
 * Images must be named Monday.gif, Tuesday.gif etc
 */


// Change to the location of the folder containing the images
$image_folder = "images/days";

// You do not need to edit below this line
$today = date('l');
if (file_exists($image_folder."/".$today.".gif")) {
  echo "<img src=\"$image_folder/".$today.".gif\">";
}
else {
  echo "No image was found for $today";
}
?>




Post a reply
  Related Posts  to : Display a different image for each day of the week
 get week day name or month name     -  
 Image-Viewer-Image Processing-Filters-Noise-enhancements     -  
 display list     -  
 Here is how to display any 2d array     -  
 SEVEN SEGMENT DISPLAY     -  
 Move image in front of a background image     -  
 Can I display same vertically on right side?     -  
 How can i display these items in Listview in C#?     -  
 Display images on jsp from servlet     -  
 Need Java program for display the CPU usage     -  

Topic Tags

PHP Date