Results 1 to 2 of 2

Thread: Random Image By Day.

  1. #1
    Join Date
    Dec 2004
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Random Image By Day.

    Hi,

    I'm using a phpBB mod called ezPortal,well I made a block to add a random image by day,for example if it's monday i would like a script that could select the images for monday and display them randomly. A few months ago someone here helped me get a great random image script that has sessions :

    PHP Code:
    <?php
      error_reporting
    (E_ALL);
      
    session_start();

      
    $image = array(
        array(
          
    'image' => 'images/image.jpg',
          
    'link' => 'http://url.com'
       
    ),
        array(
          
    'image' => 'images/image.jpg',
          
    'link' => 'http://url.com'
        
    )
      );

      if(!isset(
    $_SESSION['curing']))
        
    $_SESSION['curing'] = rand(0count($image) - 1);

      
    $image $image[$_SESSION['curing']];

      
    $image '<a href="' $image['link'] . '" target="_top"><img src="' $image['image'] . '" border="0"></a>';
    ?>
    <html>
    <head>
    </head>

    <body>
    <?php echo($image); ?>
    </body>
    </html>
    Can anyone help me maybe modify this script a bit to display the images by the day?

    Thanks for your time

    Regards

    Mick

  2. #2
    Join Date
    Dec 2004
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok i found a cool random image by day script,but since Im a php noob i was wondering if you could help me modify it a bit to my needs.

    PHP 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 "templates/bLock/rotating/";

    // 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";
    }

    ?>

    This script selects the image from a folder like Monday.gif Tuesday.gif, I wanted to have multi images for that day.Would it be possible to instead of select from one folder it can select from 7 diff ones named /Monday Tuesday/ ect... so that I can upload the pictures i would like to appear on a specific day to its respective folder.

    Another problem is the date,it uses the servers date and not mine. Is there anyway I could specify it to get the date from a time server like time.microsoft.com ?

    Thanks for your help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •