Reputation: 13
I need your help because I do not know how to fix that little issue by myself.
How can I get the basename()
for each image on $remaining
but not that image from $recent?
<?php
foreach (glob('upload-gallery/*.{gif,png,jpg,jpeg,csv}', GLOB_BRACE) as $f) {
$list[filemtime($f) . '-' . $f] = $f;
}
$keys = array_keys($list);
rsort($keys);
$recent = basename($list[array_shift($keys)]); // Get newest image
$remaining = $keys; // Get the rest of images (basename)
?>
Upvotes: 0
Views: 56
Reputation: 13
I got some help already:
<?php
foreach (glob('upload-gallery/*.{gif,png,jpg,jpeg,csv}', GLOB_BRACE) as $f) {
$list[filemtime($f) . '-' . $f] = basename($f);
}
krsort($list);
$recent = array_shift($list); // Recent image
$remaining = array_values($list); // Remaining images
?>
It works perfect now nevertheless thank you.
Upvotes: 1