Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 14 Apr 2004, 14:29
Owen Owen is offline
 
Join Date: Jan 2002
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...
Reply With Quote
  #2  
Old 14 Apr 2004, 21:51
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
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
Reply With Quote
  #3  
Old 15 Apr 2004, 13:08
Owen Owen is offline
 
Join Date: Jan 2002
Would I somehow use the count function to count the files that class dir outputs?
Reply With Quote
  #4  
Old 15 Apr 2004, 14:24
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
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
Reply With Quote
  #5  
Old 15 Apr 2004, 14:36
Owen Owen is offline
 
Join Date: Jan 2002

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now I have this, doesnt seem to look for subdirectories though, how do I make it do so?
Reply With Quote
  #6  
Old 15 Apr 2004, 14:37
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
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
Reply With Quote
  #7  
Old 15 Apr 2004, 14:39
Owen Owen is offline
 
Join Date: Jan 2002
Problem being, I have no idea how to do that.
Reply With Quote
  #8  
Old 16 Apr 2004, 17:31
Owen Owen is offline
 
Join Date: Jan 2002
Could someone please help me make this recursive?
Reply With Quote
  #9  
Old 17 Apr 2004, 18:49
NTLDR's Avatar
NTLDR NTLDR is offline
 
Join Date: Apr 2002
Real name: Lee Botley, BSc (Hons)
Here is some pseudo code on how to do it:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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
Reply With Quote
  #10  
Old 17 Apr 2004, 20:50
Owen Owen is offline
 
Join Date: Jan 2002
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.
Reply With Quote
  #11  
Old 24 Apr 2004, 11:48
Owen Owen is offline
 
Join Date: Jan 2002
Well I found a much better way of doing it.

So for anyone who is interested:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 17:58.

Layout Options | Width: Wide Color: