Avatars Project
![]()
My latest project is creating a management system for my avatars. So far I have one directory called “avatars” and inside I have this sort of folder structure:
/avatars/category/subcategory/img.jpg
where there are multiple categories and subcategories. I want to create a page that displays all avatars from all categories and subcategories by order of file date modified. I’m not using MySQL to organize folder information though now I’m thinking it would be helpful to use MySQL.
I’ve created a very rough code that involves reading the categories and storing them in an array, then reading the sub categories and storing them into an array and using while loops so as to be able to retrieve all the array values when needed throughout the code. I’m stumped however, since at the moment the avatars are printed by category then sub category rather than just by date modified. I’m also having issues with a certain function (located on line 80) where if I declare it inside the while loops, it produces an error, but if I place it outside and out of the context it’s in, it doesn’t do what I want it to do which is to only display nine avatars per page and many avatars repeat while some aren’t displayed at all.
Here’s what I have. I know the code looks atrocious. I’m not that fluent with PHP though and I’m actually modifying a pre-existing script to do what I want it to do. If anyone can help me that would be great. I’ll keep working on it myself as well.
Edit: 6.4.09
The page is now working! I may write something for others to use as well if they’d like to manage avatars without using a database to store information on the avatars. You may see it working here.
Similar Posts
Creating a RSS Feeds Page, New Avatars,

Definitely look into SQL, not just because it’s easier to organize the data, but the code is much cleaner (trust me on this one, i’ve done it the hard way and have seen the light…).
I actually really like the tagging system in Wordpress where you can apply any number of tags to a resource - like an image - and then fetch by date. Though perhaps that functionality isn’t as useful for you, but it’s pretty trivial to implement in SQL, among other things.