![]() |
|
Thread Tools |
#1
|
|||
|
|||
Counting .jpg images
I have a wallpapers directory with a lot of subdirectories like this:
wallpapers/category/item/file.jpg for every jpg there is also a thumnail, so I'd like to divide the total number of jpg's by 2 so I get my wallpaper count. I have had a looka t some functions at php.net but wasnt able to figure it out... No members have liked this post.
|
#2
|
||||
|
||||
on php5 this might help:
http://de2.php.net/manual/de/function.scandir.php on php4 you can use the dir class: http://www.php.net/manual/class.dir.php No members have liked this post.
|
#3
|
|||
|
|||
Would I somehow use the count function to count the files that class dir outputs?
No members have liked this post.
|
#4
|
||||
|
||||
should be possible, but i don't know if you have to create a new dir class for each subdirectory or not.
I haven't worked much with this class, it just know it's name an thought it may help ya ![]() No members have liked this post.
|
#5
|
||||
|
||||
Now I have this, doesnt seem to look for subdirectories though, how do I make it do so? No members have liked this post.
|
#6
|
||||
|
||||
you have to write it recursively.
so wheneve the pointer shows to a directory instead of a file, then call the function using that subdirectory No members have liked this post.
|
#7
|
|||
|
|||
Problem being, I have no idea how to do that.
No members have liked this post.
|
#8
|
|||
|
|||
Could someone please help me make this recursive?
No members have liked this post.
|
#9
|
||||
|
||||
Here is some pseudo code on how to do it:
Thats a basic 'shell' of how to do it.
__________________
Lee Botley, BSc (Hons) - vBulletin.org Moderator http://www.thesistersthree.com/lee/sigs/signature.ts3 The Sisters Three Charmed Discussion Forums WinterDir .:. vBindex v2.1 for vB2 .:. vBindex v3.0.0 RC5 for vB3 No members have liked this post.
|
#10
|
|||
|
|||
I have seen code that lists things recursively, I am just not good enough at php to make an image counter with such a code.
No members have liked this post.
|
#11
|
||||
|
||||
Well I found a much better way of doing it.
So for anyone who is interested:
No members have liked this post.
|
![]() |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 00:01.