Solved how to display a list of images in php

December 14, 2012 at 14:48:01
Specs: Windows XP
I want to display images instead of image names from last (top) to first (bottom)
I appreciate any help.
Here;s my code
I appreciate any help.

<body>

<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$thelist .= '<LI>

'.$file.'';
}
}
closedir($handle);
}
?>

List of files:</p>
<UL>

<?=$thelist?></p>
</UL>





</body>


See More: how to display a list of images in php

Report •

#1
December 14, 2012 at 19:21:46
✔ Best Answer
Syntax may be a little off but you get the idea:

<body>
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$thelist .= '<LI>

<img src="'.$file.'"</img>';
}
}
closedir($handle);
}
?>
List of files:</p>
<UL>
<?=$thelist?></p>
</UL>




</body>

Tony


Report •

#2
December 19, 2012 at 07:24:04
Hi.

Thank you very much for your help.
I pasted it and it worked perfectly.

Just one thing. I still don;t have the last uploaded image on top.
I don't want to be a pain but, take a look at this.

last image is here
http://www.765000.com/1images/pix10...

but picture is furher down
http://www.765000.com/1images/list.php



Report •

#3
December 19, 2012 at 09:42:04
When you say last, what do you mean exactly? Is the last image the newest image? Or do you just want them displayed in the reverse order that they are now?

Tony


Report •
Related Solutions


Ask Question