Jump to content

Display all images within a folder


a.beam.reach

Recommended Posts

I am currently using the following code to return a page that displays all the pictures within a folder:

 
echo'';   $array=glob('ebayimg/9150gba041117/size_2/*');
foreach($array as $zf) 
echo '<img src="http://www.gbamedical.com/'.$zf.'">’;

 
I need to be be able to do similar to the below code. . . only, there needs to be two occurrences of each picture in the code and I need to dynamically add the word "image1, image2, etc" for however many pictures are in the folder. . . .   as shown below.   The below example shows just two pictures but I need it to return code for however many pictures are in the folder.

<div class="slider">

  <input type="radio" name="slide" id="image1" checked/>
  <label for="image1">
<img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9633.JPG"/>
</label>
  <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9633.JPG" height="480"/>

  <input type="radio" name="slide" id="image2"/>
  <label for="image2">
<img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9638.JPG"/>
</label>
  <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9638.JPG" height="480"/>
</div>

Thanks in advance for any help you can offer me!

 

Trevor

Link to comment
Share on other sites


Try this:

<div class="slider">
<?php
$array=glob('ebayimg/9150gba041117/size_2/*');
foreach($array as $zf){
?>

<input type="radio" name="slide" id="<?php echo $zf ;?>" checked/>
<label for="image1">
<img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/<?php echo $zf ;?>"/>
</label>
<img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/<?php echo $zf ;?>" height="480"/>

<?php } ?>
</div>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.