Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default Php random image selector

    Ok does anyone know the code so I can have random images on my page each time the page is refreshed :S I have used one including a flatfile but it just messes up alot so any ideas??? Btw this is for affiliates


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

  2. #2
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Splinter ill find it give me a sec ok?

  3. #3
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    to Show
    <img src="/dropbox/2003/rotate/rotate.php" alt="A Random Image" />



    <?php
    /*
    By Matt Mullenweg > http://photomatt.net
    Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
    Latest version always at:
    http://photomatt.net/scripts/randomimage
    */

    // Make this the relative path to the images, like "../img" or "random/images/".
    // If the images are in the same directory, leave it blank.
    $folder = '';

    // Space seperated list of extensions, you probably won't have to change this.
    $exts = 'jpg jpeg png gif';

    $files = array(); $i = -1; // Initialize some variables
    if ('' == $folder) $folder = './';
    $handle = opendir($folder);
    $exts = explode(' ', $exts);
    while (false !== ($file = readdir($handle))) {
    foreach($exts as $ext) { // for each extension check the extension
    if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
    $files[] = $file; // it's good
    ++$i;
    }
    }
    }
    closedir($handle); // We're not using it anymore
    mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
    $rand = mt_rand(0, $i); // $i was incremented as we went along

    header('Location: '.$folder.$files[$rand]); // Voila!
    ?>

  4. #4
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    does it work?

    [Edited By Partie2] (Forum Moderator) please dont post multiple posts after each other just edit your last one
    Last edited by partie2; 04-08-2005 at 08:40 AM.

  5. #5
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    i did a tutoral on dinamicly random images a while ago if thats useful "/

    http://habboxforum.com/showthread.php?t=45838
    Last edited by Mentor; 04-08-2005 at 11:21 AM.

  6. #6
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    uses the fourm search thnx Caleb +rep


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

  7. #7
    Join Date
    Jul 2004
    Location
    Bournemouth. UK
    Posts
    3,638
    Tokens
    0

    Latest Awards:

    Default

    Mentor wasn't that code for random image in your signature?!
    PHP Code:
    <?php

    $stuff 
    = array (
                    
    => "5.png",
                    
    => "banner2.png",
                    
    => "banner3.png",
                    );
    $display=rand(0sizeof($stuff)-1);

    //write banner
    echo "<img src='".$stuff[$display]."'>";

      
    ?>
    REMOVED

    Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.

  8. #8
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    no he has sort of placed the file with all that in into his signature..


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

  9. #9
    Join Date
    Jul 2004
    Location
    Bournemouth. UK
    Posts
    3,638
    Tokens
    0

    Latest Awards:

    Default

    I always wondered how he did that... That tutorial didn't help me really
    REMOVED

    Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.

  10. #10
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    its more aless same as the one posted here, exspet it has a load of header info, includes the file and uses htaccess to become a png "/

Posting Permissions

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