MuntedMess.com - Online diary and webcam of Rhiannon, 26 year old Australian girl.

MENU
navigation



MUSIC
i obsess over


Google
 

Wednesday, July 12, 2006

PHP rotating image idea

changed the top header pic again... we took some more photos today and i want to implement some sort of rotating header image thing. every time you refresh the page the image changes and rotates between about half a dozen different images.

this shouldn't be too hard, as there are lots of free php scripts out there that do this. what might be a problem is i've actually got two images.... the header and the column header.

so i need the script to not only choose a random header image, but also to make sure the column header image matches up to the header image. any php guru's out there with too much time on their hands?


nevermind, its up and working thanks to aaron!
there's 6 different headers so far, maybe more to come....

10 Comments:

  • At July 12, 2006 3:30 PM, Blogger Strongblade! said…

    I had to refresh a few times, but I can now see it (Hmmm... time to clean out ye olde internet cache, methinks...)

    Looks much better now :)

     
  • At July 12, 2006 8:07 PM, Anonymous aussiebofh said…

    I've whipped up a quick and dirty example (I see a lot of PHP in my line of work even though I'm primarily a Perl hacker) however Blogger won't let me post it here (won't allow inline scripting languages) so I've emailed something through to you.

    In summary,
    - an $array containing pairs of images located in a handy directory on the site.
    - a little random number generation to randomly pick the "pair"
    - Which is then fed to your img src markup later on.

    If you have a database you can use the following little schema (MySQL, why yes I am cheap, thanks for asking!)

    CREATE TABLE `random_images` (
    `header_image` VARCHAR( 40 ) NOT NULL ,
    `column_image` VARCHAR( 40 ) NOT NULL ,
    `id` INT( 3 ) NOT NULL
    ) ENGINE = MYISAM

    and get your array via "mysql_query("SELECT header_image,column_image FROM random_images WHERE id = " . $randomnumber . ";");"

    It's as ugly as the south end of a north-travelling horse, but it is functional.

    Michael.

     
  • At July 12, 2006 8:34 PM, Blogger aaron said…

    ooh, I like the font on the heading on #6. it's kind of fitting cos it looks a little munted.

     
  • At July 12, 2006 9:56 PM, Anonymous TenaciousAC said…

    That's both simple and cool. Comes in handy when you feel like doing something different. 10AC

     
  • At July 12, 2006 10:58 PM, Blogger Strongblade! said…

    That's awesome! A new image every time I visit! :D

     
  • At July 13, 2006 7:55 AM, Anonymous Brian said…

    I have a sick obsession with argyle vests.

    I have too many and its bad. I'm trying to be an old man when I'm not even 21 yet!

     
  • At July 13, 2006 8:02 AM, Blogger reanon said…

    noooo brian its not bad. vests on boys = cute!

     
  • At July 13, 2006 9:49 PM, Blogger aaron said…

    hand me a vest and I'll disprove that statement (or just prove that I'm no longer a boy)

     
  • At July 13, 2006 11:37 PM, Anonymous verbs said…

    I'm a vest wearer from way back. It's always had the "old man" stigma attached, but I think because I'm so little they tend to suit me, kind of.

    Plus I'm an old man.

     
  • At July 13, 2006 11:39 PM, Blogger Strongblade! said…

    The one with the popped bubblegum is great (And the font for the header is great as well!

     

Post a Comment

<< Home