image rotation


I just created a php function that can randomly display images everytime you hit refresh button. this code is needed if you wanted to create a photo album that changes everytime you visit the webpage. here is the code


    <?
     $Img1 = "http://i.imgur.com/qK5o2Lu.jpg?1";
     $Url1 = "http://jacobian.xyz";

    $Img2 = "http://jacobian.xyz/gallery/var/albums/DSC08942.JPG"; $Url2 = "http://karengnayong.com";

    $Img3 = "http://jacobian.xyz/gallery/var/albums/DSC08943.JPG"; $Url3 = "http://karengnayong.co.id";

    $Img4 = "http://jacobian.xyz/gallery/var/albums/DSC08467.JPG"; $Url4 = "http://karengnayong.co.id";
    $Img5 = "http://jacobian.xyz/gallery/var/albums/DSC08331.JPG"; $Url5 = "http://karengnayong.co.id";
    $Img6 = "http://jacobian.xyz/gallery/var/albums/DSC01781.JPG"; $Url6 = "http://karengnayong.co.id";
    $Img7 = "http://jacobian.xyz/gallery/var/albums/DSC07921.JPG"; $Url7 = "http://karengnayong.co.id";
    $Img8 = "http://jacobian.xyz/gallery/var/albums/DSC07928.JPG"; $Url8 = "http://karengnayong.co.id";
    $Img9 = "http://jacobian.xyz/gallery/var/albums/DSC07932.JPG"; $Url9 = "http://karengnayong.co.id";
    $Img10 = "http://i.imgur.com/sVpn1nd.jpg"; $Url0 = "http://karengnayong.co.id";

    $num = rand (1,10);
     $Image = ${'Img'.$num};
     $URL = ${'Url'.$num};

    Print "<a href=".$URL."><img src=".$Image." border=0></a>";
    ?>

I put the code in my copy paste website so it would be easy to share code there. and you can check the image rotation link here

note: some picture appears larger than other due to size. use zoom out and zoom in

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s