Results 1 to 5 of 5

Thread: Help loading images on a set date?

  1. #1
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help loading images on a set date?

    Hey everyone,

    I am new here - so forgive me if this is in the wrong thread.

    I am looking for a script in PHP to load a specific image on a certain date..

    Example

    Says its the 4th of July - it would load the image for the July4.jpg etc etc...

    Can anyone help us with this?

    Xtrax

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    PHP Code:
    $today=date('Fj'); // Get the date today in MonthDate format
    echo "<img src='{$today}.jpg' alt='{$today}'>"// Creates image 
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your reply,

    So if I wanted to load an image July 4, and then a second image say Dec 25,

    could I use this...

    PHP Code:
    $today=date('Fj'); // Get the date today in MonthDate format 
    $today ="7/4";
    }else{
    $today ="12/25";
    }
    echo 
    "<img src='{$today}.jpg' alt='{$today}'>"// Creates image 
    I need a little guidance I just started with my PHP Website a few days ago...

    Xtrax

  4. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    PHP Code:
    $today=date('Fj'); // Get the date today in MonthDate format  
    $src='default.jpg'// Default image in case date today is neither July4 or December25

    // If date today is either December25 or July4, then set the source to today's date, else show default
    $src=$today=='December25'||$today=='July4'?$today:$src;

    echo 
    "<img src='{$src}.jpg' alt='{$src}'>"// Creates image 
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  5. #5
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I thank you for your time!

    It works great as I just tested it!

    xtrax

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
  •