Are there any best practices for organizing photo categories and folders when handling photos in PHP?

When handling photos in PHP, it's important to organize them into categories and folders to maintain a structured and easily accessible collection. One best practice is to create a folder structure that reflects the categories of the photos, such as "landscape", "portrait", "events", etc. Within each category folder, you can further organize the photos by date, event name, or any other relevant criteria.

// Example code snippet for organizing photos into categories and folders
$categories = ['landscape', 'portrait', 'events'];

foreach ($categories as $category) {
    $categoryPath = 'photos/' . $category;
    
    if (!file_exists($categoryPath)) {
        mkdir($categoryPath, 0777, true);
    }
    
    // Move photos to their respective category folders
    // You can use functions like rename() or copy() to move files
}