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 6 of 6
  1. #1
    Join Date
    Jul 2005
    Location
    Leeds
    Posts
    947
    Tokens
    0
    Habbo
    Flumples

    Default Display all images in [folder]

    Anyone know how I can have a simple page that'll display every single image in a certain directory.

    for example...

    www.mysite.com/images.php

    would display every single image in

    www.mysite.com/images

    Nothing fancy, as long as it does the job that's fine


    EDIT: Scrap that, this does the trick:

    PHP Code:
    <?php
    // Note that !== did not exist until 4.0.0-RC2

    if ($handle opendir('/path/to/image/directory')) {
        echo 
    "Directory handle: $handle\n";
        echo 
    "Files:\n";

        
    /* This is the correct way to loop over the directory. */
        
    while (false !== ($file readdir($handle))) {
             echo 
    "<img src='http://www.mysite.com/images/";
            echo 
    "$file\n";
            echo 
    "'><br />";
        }

        
    /* This is the WRONG way to loop over the directory. */
        
    while ($file readdir($handle)) {
            echo 
    "$file\n";
        }

        
    closedir($handle);
    }
    ?>
    Last edited by Flumples; 05-04-2007 at 08:20 PM.

  2. #2
    Join Date
    Oct 2006
    Posts
    2,918
    Tokens
    946
    Habbo
    Verrou

    Latest Awards:

    Default

    Warning: opendir() [function.opendir]: open_basedir restriction in effect. File(/path/to/image/directory) is not within the allowed path(s): (/home/andre:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/andre/public_html/uploader/images.php on line 4

    Warning: opendir(/path/to/image/directory) [function.opendir]: failed to open dir: Operation not permitted in /home/andre/public_html/uploader/images.php on line 4

    Huh?
    Quote Originally Posted by Special-1k View Post
    How do you uninstall an internet? I want to uninstall my Google Chrome and
    get firefox but I never really got rid of an internet my dad usually did it for me.
    If you know how post below so I can do this.

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

    Latest Awards:

    Default

    Quote Originally Posted by Verrou View Post
    Warning: opendir() [function.opendir]: open_basedir restriction in effect. File(/path/to/image/directory) is not within the allowed path(s): (/home/andre:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/andre/public_html/uploader/images.php on line 4

    Warning: opendir(/path/to/image/directory) [function.opendir]: failed to open dir: Operation not permitted in /home/andre/public_html/uploader/images.php on line 4

    Huh?
    You have to change /path/to/image/directory), to what it says, in your case i think that would be /home/andre/public_html/ . possibly with an image folder name on the end if your useing one

  4. #4
    Join Date
    Oct 2006
    Posts
    2,918
    Tokens
    946
    Habbo
    Verrou

    Latest Awards:

    Default

    Warning: opendir(http://andrehamon.evenhosting.com/uploader/images/) [function.opendir]: failed to open dir: not implemented in /home/andre/public_html/uploader/images.php on line 4

    Uh?
    Last edited by Verrou; 05-04-2007 at 11:27 PM.
    Quote Originally Posted by Special-1k View Post
    How do you uninstall an internet? I want to uninstall my Google Chrome and
    get firefox but I never really got rid of an internet my dad usually did it for me.
    If you know how post below so I can do this.

  5. #5
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    Quote Originally Posted by Verrou View Post
    Warning: opendir(http://andrehamon.evenhosting.com/uploader/images/) [function.opendir]: failed to open dir: not implemented in /home/andre/public_html/uploader/images.php on line 4

    Uh?
    Lol change it to:

    /home/andre/public_html/uploader/images

    or try chmoding the images to 777 - might work i dunno lol

  6. #6
    Join Date
    Oct 2006
    Posts
    2,918
    Tokens
    946
    Habbo
    Verrou

    Latest Awards:

    Default

    Ok got it working, thanks very much +rep to all!
    Quote Originally Posted by Special-1k View Post
    How do you uninstall an internet? I want to uninstall my Google Chrome and
    get firefox but I never really got rid of an internet my dad usually did it for me.
    If you know how post below so I can do this.

Posting Permissions

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