Solved

How to display all images in a folder?

Posted on 2008-10-10
4
807 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

728 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