Link to home
Start Free TrialLog in
Avatar of Daniish
DaniishFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to display all images in a folder?

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

Avatar of babuno5
babuno5
Flag of India image

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=''/>
ASKER CERTIFIED SOLUTION
Avatar of babuno5
babuno5
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daniish

ASKER

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.
Avatar of Daniish

ASKER

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.