Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9253109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:07:57+00:00 2026-06-18T11:07:57+00:00

I am importing some files to a folder using everything is ok and all

  • 0

I am importing some files to a folder using everything is ok and all the files get inserted normally, but the problem begins when I try to show thumbnails of these files on my browser. In this case just some of the files can be shown perfectly and others are shown az empty rectangular! While all the files are located in the same folder!
I investigated more and realized that the images that their original source(on computer) was close to the folder path are being shown perfectly and others not.

For instance my folder locates in: c://xampp/htdocs/test/folder
I have put all the picturs in folder, but just the images that originally where available at c://xampp/htdocs/test are being shown and not others.

Please help me

the code:

    $images=array();  
    $dir_handler = opendir('test/folder') or die("Unable to open $path");  
    $i=0;    
    while($file = readdir($dir_handler))
    {            
    if(is_dir($file)) 
    continue;        
    else if($file != '.' && $file != '..' && $file != 'index.php')
    {                    
    $images[$i]=$file;
    $i++;     
    }       
    }      
    sort($images);

    for($i=0; $i<sizeof($images); $i++) 
    {              

    echo "<a href=".chr(34).$path.$images[$i].chr(34)."><img style='border:1px solid #666666; width:100px;height:100px; margin: 10px;' src='".$images[$i]."'/></a>";

    }        closedir($dir);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:08:00+00:00Added an answer on June 18, 2026 at 11:08 am

    It may be more helpful to use SPL’s Directory iterator in this case.

    In this code example, I’m assuming your path was to ‘test/folder’ – which contained images and an index.php file.

    $path = 'test/folder';
    foreach (new DirectoryIterator($path) as $fileInfo) {
        if ($fileInfo->isFile() && $fileInfo->getFilename() != 'index.php') {
            $image = "{$path}/{$fileInfo->getFilename()}";
            echo "<a href='{$image}'><img src='{$image}'></a>"; // style as appropriate
        }
    }
    

    This creates a new DirectoryIterator on your path. Then, if the result is indeed a file, and not named index.php, the variable $image is populated with the path and the filename. The echo statement has a shorter version of your example code to output the a/img tag combination.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm importing some images dynamically into a SWF from an external site using AS2.
I am facing some weird problem when importing .war file into eclipse. The problem
Hello all I have some very important system files which I want to protect
I have a folder A which contains some Python files and __init__.py. If I
I have some questions about importing data from Excel/CSV File into SQL Server. Let
I am importing data from csv file, sometimes there are column headers and some
i am generating *.reg file using code which will have some important data. and
I'm importing some XML to C#, and want to be able to access data
I am learning ruby on rails. I started by importing some data into a
I did a mistake importing in an import to some SubVersion repository, and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.