SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,658
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    display all images...

    I have a folder full of images, ad im trying to use php to display them, is this right?
    PHP Code:
    <?php
    $handle 
    opendir(dirname(realpath(__FILE__)).'/../images/dolls/'.$row['id']);
    while(
    $file readdir($handle)){
    echo 
    '<img src="realpath(__FILE__)).'/../images/dolls/'.$file.'" border="0" />';
    }
    ?>
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Did you run it and test if it works?
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,658
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I dont see the images
    http://nikelantiquedolls.com/wordpress/?page_id=13&id=6
    here is the folder im trying to look into
    http://nikelantiquedolls.com/wordpre...images/dolls/6
    it has nine images in it (1-9.jpg)
    "Oh, and Jenkins--apparently your mother died this morning."

  4. #4
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,658
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    wordpress is strange, cause I get this
    /home/nikel0/public_html/wordpress/wp-content/plugins/exec-php/includes
    output by
    PHP Code:

        <?php
        
    echo realpath(dirname(__FILE__));
        
    ?>
    "Oh, and Jenkins--apparently your mother died this morning."

  5. #5
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,435
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    I would use glob with relative paths and echo $ file in your while loop to see what it contains. Also does $row['id'] contain anything?

  6. #6
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,883
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by lukeurtnowski View Post
    wordpress is strange, cause I get this
    /home/nikel0/public_html/wordpress/wp-content/plugins/exec-php/includes
    output by
    PHP Code:

        <?php
        
    echo realpath(dirname(__FILE__));
        
    ?>
    Try this and scroll to the bottom for the source;
    http://johns-jokes.com/afiles/gif/
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  7. #7
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,658
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    ok, so its working,
    http://nikelantiquedolls.com/wordpress/?page_id=13
    using
    PHP Code:
    <?php
    $files 
    glob("wp-content/themes/nikkistheme/images/dolls/".$id."/*.jpg");
    foreach(
    $files as $file){
    echo 
    '<img src="'.$file.'" border="0" />';
    }
    ?>
    is this ok?
    Last edited by guido2004; Mar 6, 2013 at 02:02. Reason: corrected php tag
    "Oh, and Jenkins--apparently your mother died this morning."


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
  •