<?php
require_once 'includes/config.php';
require_once 'includes/db.php';

// Get a product with an image
$stmt = $pdo->query("SELECT id, name, image FROM products WHERE image != '' AND image IS NOT NULL LIMIT 1");
$product = $stmt->fetch(PDO::FETCH_ASSOC);

if ($product) {
    echo "<h2>Product Image Test</h2>";
    echo "<p>Product ID: " . $product['id'] . "</p>";
    echo "<p>Product Name: " . htmlspecialchars($product['name']) . "</p>";
    echo "<p>Image Path: " . htmlspecialchars($product['image']) . "</p>";
    echo "<p>Full Image URL: " . SITE_URL . '/' . $product['image'] . "</p>";
    echo "<img src='" . SITE_URL . '/' . $product['image'] . "' style='max-width: 300px;'>";
} else {
    echo "<p>No products with images found.</p>";
}
?>