Webcam Script

<?php
$image_url = "http://192.168.178.30/motion/-snapshot.jpg";
// Testen, ob das Bild erreichbar ist
$headers = @get_headers($image_url);
$cam_online = $headers && strpos($headers[0], "200 OK") !== false;
?>
<center><!DOCTYPE html>
<html>
<head
<title>Livebild Status</title>
    <style>
        .status {
            font-size: 15px;
            font-weight: bold;
            padding: 10px;
            margin-bottom: 20px;
            border-radius: 5px;
            display: inline-block;
        }
        .on {
            background-color: #28a745;
            color: white;
        }
        .off {
            background-color: #dc3545;
            color: white;
        }
        img {
            width: 550px;
            height: 280px;
            border: 4px solid #333;
            border-radius: 8px;
            box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
        }
        .online-img {
            border-color: #cccccc;
        }
        .offline-img {
            border-color: #ffffff;
        }
    </style>
</head>
<body>
    <h1>Kamera-Status</h1>
    <div class="status <?= $cam_online ? 'on' : 'off' ?>">
        <?= $cam_online ? 'LIVE  Kamera ON' : '? Kamera OFF' ?>
    </div>

    <?php if ($cam_online): ?>
        <img src="<?= $image_url ?>" alt="Livebild" class="online-img">
    <?php else: ?>
        <p>?? Das Livebild ist momentan nicht verf gbar.</p>
    <?php endif; ?>