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

// Test student photo retrieval for student 6193
$stmt = $pdo->prepare('SELECT id, first_name, last_name, photo FROM students WHERE id = ?');
$stmt->execute([6193]);
$student = $stmt->fetch();

echo "Student 6193:\n";
echo "Name: " . $student['first_name'] . ' ' . $student['last_name'] . "\n";
echo "Photo path in DB: " . ($student['photo'] ? $student['photo'] : 'No photo') . "\n";

if ($student['photo']) {
    // Try the correct path
    $correct_path = 'uploads/students/student_6193_1762611303.jpg';
    echo "Correct path: " . $correct_path . "\n";
    echo "File exists: " . (file_exists($correct_path) ? 'Yes' : 'No') . "\n";
    
    // Show the actual file that exists
    $files = scandir('uploads/students');
    foreach ($files as $file) {
        if (strpos($file, 'student_6193') !== false) {
            echo "Actual file: " . $file . "\n";
        }
    }
}
?>