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 8939447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:49:30+00:00 2026-06-15T10:49:30+00:00

I am trying to make php do the following. I have a structure of

  • 0

I am trying to make php do the following.

I have a structure of folders in my root directory. /images/1234, /images/2345, /images/3456 etc. (multiple folders all in images)

I would like to get the contents of each folder and put their contents into their own div, using php and not hard coding as the folders and files will change regularly.

<div><img src="images/1234/1.jpg"><img src="images/1234/2.jpg"><img src="images/1234/3.jpg"></div>
<div><img src="images/2345/1.jpg"><img src="images/2345/2.jpg"><img src="images/2345/3.jpg"></div>
<div><img src="images/3456/1.jpg"><img src="images/3456/2.jpg"><img src="images/3456/3.jpg"></div>

The files/folders will constantly be added so these divs would have to be in some sort of foreach loop for each folder found in the images directory.

Essentially each folder in images folder would be a div, the divs would auto populate as the browser was refreshed if new folder existed.

I can make it work with php to bring out all images and just place on page,r but I need this structure instead. Thanks for any help.

  • 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-15T10:49:31+00:00Added an answer on June 15, 2026 at 10:49 am
    foreach (glob('images/*') as $dir) {
      echo '<div>'; // One div per directory
      foreach (glob($dir."/*.jpg") as $img) {
        echo "<img src='$img'/>";
      }
      echo "</div>\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following db and php. I am trying to make a unordered
i'm trying to make a php tcp/ip server with the following code: <?php //
I am trying to make a Postgres PHP backup script. I have downloaded one
I'm trying to make my custom filter work... I have the following code in
I have the following url structure: www.mysite.com/temporary/articles.php?artid=1 I would like to change it with
I am trying to make a Content Slider for my site. I have multiple
I have the following structure of my zend framework: application/ configs/ application.ini routes.php layouts/
Guys I have the following structure in my project. application/ Bootstrap.php configs/ application.ini modules/
I am trying to make a search form with php, using the following query
I am trying to make a quiz using PHP and Mysql. I have create

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.