Jump to content

Displaying images from a directory alphabeticaly in descending order by filename


AndrewFerrara

Recommended Posts

I am trying to display images on a html page alphabetically in descending order by their filename.

<?php

$dir = "./plate_cache";
$handle = opendir($dir);
while (($file = readdir($handle))!==false)
{
	if (strpos($file, '.png',1)) 
	{
	echo "<img id=\"plates\" src=\"/tags/plate_cache/$file\"></a><br />;";
	}
}
closedir($handle); 
}

?>

 

Any help is greatly appreciated!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.