<?php
require_once 'config/database.php';

// Get all students with photos
$stmt = $pdo->query("SELECT id, first_name, last_name, photo FROM students WHERE photo IS NOT NULL AND photo != '' LIMIT 5");
$students = $stmt->fetchAll();

echo "Students with photos:\n";
foreach ($students as $student) {
    echo "ID: " . $student['id'] . " - " . $student['first_name'] . " " . $student['last_name'] . "\n";
    echo "  Photo path: " . $student['photo'] . "\n";
    
    // Check if file exists in the expected location
    $expected_path = '../' . $student['photo'];
    echo "  Expected file exists: " . (file_exists($expected_path) ? 'Yes' : 'No') . "\n";
    
    // Check in uploads/students directory
    if ($student['photo']) {
        $filename = basename($student['photo']);
        $alt_path = '../uploads/students/' . $filename;
        echo "  Alternative path: " . $alt_path . "\n";
        echo "  Alt file exists: " . (file_exists($alt_path) ? 'Yes' : 'No') . "\n";
    }
    echo "\n";
}
?>