Results 1 to 8 of 8

Thread: Problem With Image Display

  1. #1
    Member
    Join Date
    Feb 2007
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question

    im having a weird problem this script is supposed to list files in a dir which in this case images i got t to display the images but i keep getting 2 blank images at the top its like its repeating can any one suggest what i have done wrong with this code?


    Code:
    $dir="wallpapers"; // Directory where files are stored
    if ($dir_list = opendir($dir))
    {
    while(($filename = readdir($dir_list)) !== false)
    {
    echo "<image src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">$filename</a>
    
    ";
    }
    closedir($dir_list);

  2. #2
    Senior Member rukiya's Avatar
    Join Date
    Apr 2007
    Location
    Bangladesh
    Posts
    572
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Rep Power
    0

    Default

    Code:
    echo "<image src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    it will be
    Code:
    echo "<img src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    [Only registered and activated users can see links. Click Here To Register...]




  3. #3
    Senior Member
    Join Date
    Jul 2007
    Location
    United States
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    wrong again here is the correct and working one

    Code:
    $dir="wallpapers"; // Directory where files are stored
    if ($dir_list = opendir($dir))
    {
    while(($filename = readdir($dir_list)) !== false)
    {
    echo "<img src=\"$dir/$filename\" height=\"50\" width=\"50\"/><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    }
    closedir($dir_list);
    }else{
    ///whatever and next
    }
    Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

    <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">[Only registered and activated users can see links. Click Here To Register...]</span></span>

    [Only registered and activated users can see links. Click Here To Register...]

  4. #4
    Senior Member
    Join Date
    Jul 2007
    Location
    United States
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    <div class='quotetop'>QUOTE (rukiya @ Oct 13 2008, 11:39 PM) [Only registered and activated users can see links. Click Here To Register...]</div>
    Code:
    echo "<image src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    it will be
    Code:
    echo "<img src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    [/b]
    there is the error
    $dir/$filename\"height=\"50\" \"width=\"50\"\
    Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

    <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">[Only registered and activated users can see links. Click Here To Register...]</span></span>

    [Only registered and activated users can see links. Click Here To Register...]

  5. #5
    Super Moderator subzero's Avatar
    Join Date
    Mar 2006
    Location
    Your Screen.
    Posts
    3,971
    Thanks
    442
    Thanked 379 Times in 180 Posts
    Blog Entries
    7
    Rep Power
    0

    Default

    Code:
    echo "<img src=\"$dir/$filename\" height=\"50\" width=\"50\"alt=\"Image\"/><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    Visit: [Only registered and activated users can see links. Click Here To Register...]
    Visit: [Only registered and activated users can see links. Click Here To Register...]
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

  6. #6
    Member
    Join Date
    Feb 2007
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    guys its still repeating 1 blank image with every pic i put in the wallpapers folder heres a screenshot of what i mean
    Code:
    http://andyj.biz/screenshotofimagesscript.bmp

  7. #7
    Junior Member djdeny's Avatar
    Join Date
    Oct 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    <div class='quotetop'>QUOTE (andyjay30 @ Oct 14 2008, 04:50 PM) [Only registered and activated users can see links. Click Here To Register...]</div>
    guys its still repeating 1 blank image with every pic i put in the wallpapers folder heres a screenshot of what i mean
    Code:
    http://andyj.biz/screenshotofimagesscript.bmp
    [/b]
    try this ;)
    Code:
    $dir="wallpapers"; // Directory where files are stored
    if ($dir_list = opendir($dir))
    {
    while(($filename = readdir($dir_list)) !== false)
    {
    if($filename!="." AND $filename!="..")
    {
    echo "<img src=\"$dir/$filename\" height=\"50\" width=\"50\"/><a href=\"$dir/$filename\">
    $filename</a>
    
    ";
    }
    }
    closedir($dir_list);
    }else{
    echo "whatever and next";
    }

  8. #8
    Super Moderator subzero's Avatar
    Join Date
    Mar 2006
    Location
    Your Screen.
    Posts
    3,971
    Thanks
    442
    Thanked 379 Times in 180 Posts
    Blog Entries
    7
    Rep Power
    0

    Default

    i see what you tryin to do here.

    You tryin to add dir and its pickin up a error with the .
    Visit: [Only registered and activated users can see links. Click Here To Register...]
    Visit: [Only registered and activated users can see links. Click Here To Register...]
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [web] 65 Most Needed Php Scripts
    By jayasanka in forum Scripts Forum
    Replies: 19
    Last Post: 09-11-10, 15:30
  2. Error Image Uploading..Please help fixing!
    By kiLLeR-eyEd_14 in forum Site / Script testing and error fixing
    Replies: 1
    Last Post: 09-05-09, 10:54
  3. Gallery problem
    By Vicelord in forum Coding Forum
    Replies: 5
    Last Post: 15-04-09, 13:30
  4. Momail
    By thanatos in forum Site / Script testing and error fixing
    Replies: 2
    Last Post: 26-08-08, 01:15
  5. Html Tutorial
    By lamar-wap in forum Tutorials
    Replies: 1
    Last Post: 06-09-06, 22:27

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
  •  

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19