Solved

How to display all images in a folder?

Posted on 2008-10-10
4
769 Views
Last Modified: 2010-04-21
Hello,

I'm using the attached code snippet to display all the images in a folder.

The problem is with this line:
<img src='../thumbphp/phpThumb.php?src=/travel_pics/$file/'.*.*.'&w=100' alt=''/>

I can't get the *.* to work - what am i doing wrong?


Cheers
<?php

if ($handle = opendir('travel_pics/'.$id.'/')) {

while (false !== ($file = readdir($handle))) {

if ($file != "." && $file != "..") {

echo "

<a id='thumb1' href='../public_html/travel_pics/$file/' onclick='return hs.expand(this)' class='highslide'>

<img src='../thumbphp/phpThumb.php?src=/travel_pics/$file/'.*.*.'&w=100' alt=''/>

</a>

";

}

}

closedir($handle);

}

?>

Open in new window

0
Comment
Question by:Daniish
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:babuno5
ID: 22685735
i dont know why you require *.*

just if it was supposed to be there then it should be

<img src='../thumbphp/phpThumb.php?src=/travel_pics/$file/.*.*.&w=100' alt=''/>
0
 
LVL 15

Accepted Solution

by:
babuno5 earned 500 total points
ID: 22685790
i think this should work

echo "
<a id='thumb1' href='/travel_pics/$id/$file/' onclick='return hs.expand(this)' class='highslide'>
<img src='../thumbphp/phpThumb.php?src=/travel_pics/$id/$file/&w=100' alt=''/>
</a>
";
0
 

Author Comment

by:Daniish
ID: 22685905
I'm trying to get it to load all images from each folder....but as you can see it hasn't worked:

www.globxposure.net/index.php

Ultimately the purpose of this exercise is that when you click on an image (click on the Norwich marker), you get the option to view Next/Previous image - and i would like it to cycle through the images that are in the same folder as the image the user has just selected.

Hope you understand me.
0
 

Author Closing Comment

by:Daniish
ID: 31504956
This was a badly worded question on my part, however, another expert has helped me out so i no longer need to keep this open.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now