Problem With Image Display

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem With Image Display

    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\">[b]$filename[/b]</a>
    
    ";
    }
    closedir($dir_list);

    #2
    Code:
    echo "<image src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">[b]
    $filename[/b]</a>
    
    ";
    it will be
    Code:
    echo "<img src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">[b]
    $filename[/b]</a>
    
    ";

    Comment


      #3
      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\">[b]
      $filename[/b]</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%">BEST MOBILE ADVERTISER</span></span>

      Comment


        #4
        <div class='quotetop'>QUOTE (rukiya @ Oct 13 2008, 11:39 PM) <{POST_SNAPBACK}></div>
        Code:
        echo "<image src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">[b]
        $filename[/b]</a>
        
        ";
        it will be
        Code:
        echo "<img src=\"$dir/$filename\"height=\"50\" \"width=\"50\"\><a href=\"$dir/$filename\">[b]
        $filename[/b]</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%">BEST MOBILE ADVERTISER</span></span>

        Comment


          #5
          Code:
          echo "<img src=\"$dir/$filename\" height=\"50\" width=\"50\"alt=\"Image\"/><a href=\"$dir/$filename\">[b]
          $filename[/b]</a>
          
          ";
          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
          Visit: WapMasterz Coming Back Soon!
          _______
          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

          Comment


            #6
            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

            Comment


              #7
              <div class='quotetop'>QUOTE (andyjay30 @ Oct 14 2008, 04:50 PM) <{POST_SNAPBACK}></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\">[b]
              $filename[/b]</a>
              
              ";
              }
              }
              closedir($dir_list);
              }else{
              echo "whatever and next";
              }

              Comment


                #8
                i see what you tryin to do here.

                You tryin to add dir and its pickin up a error with the .
                Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                Visit: WapMasterz Coming Back Soon!
                _______
                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

                Comment

                Working...
                X