Solved

How to display all images in a folder?

Posted on 2008-10-10
4
808 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

632 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