Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how i can show my all images on the basis of last updated image....means will show first in last updated images

What I have tried:

PHP
<?php
$files = glob("gallery/*.*");
for ($i = 0; $i < count($files); $i++) { 
$image = $files[$i];
$file=$files[$i];
$info = pathinfo($file);
$file_name = basename($file,'.'.$info['extension']);
echo $file_name; // outputs 'image'
echo '' . "

";
}
?>
Posted
Updated 8-Feb-19 2:16am
v3

1 solution

Your problem is using glob() - which species that it return an array of file names. And that's all.

You need to get the file list by using the php File System functions[^] You can use this to get file list and properties for the files.

There's an lot of stuff you should learn about so you can handle files efficiently and, in the long term, much more easily.


 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900