|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
||||
|
||||
|
Good day to you all,
I'm building a little image directory viewer and I want it to list the images by date they were uploaded and within that by landscape or portrait. I would need newest on top. Here is the code I have so far : PHP Code:
Can someone guide me with this please ? Thanks ! Have a nice day !
__________________
That's why we are not alone on earth, to help each other ! Let's build ! |
|
#2
|
||||
|
||||
|
First of all, you have many unnecessary calls to sort(). I would rewrite your directory reading loop:
PHP Code:
That should work. I didn't test it, though. If you need to show the file modification time in a human readable format you can use date() to do that.
__________________
Fight Internet censorship! Code:
() ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments |
|
#3
|
||||
|
||||
|
I can't make it to work, I had implemented it but here what I have done and what it do :
PHP Code:
it give me : Warning: readdir(): supplied argument is not a valid Directory Can you help me again? |
|
#4
|
||||
|
||||
|
That's because you're now calling your directory name variable $val0 instead of $imgdir like you previously did.
|
|
#5
|
||||
|
||||
|
Now it give me this :
Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in PHP Code:
|
|
#6
|
||||
|
||||
|
D'oh... this mistake was so stupid I'm ashamed. The $fmodtime line should be
PHP Code:
Last edited by tkarkkainen : May 18th, 2008 at 10:18 AM. Reason: removed an extra bracket |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > php4 - Sort (date & size) listing of dir. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|