diff --git a/Readme.md b/Readme.md old mode 100644 new mode 100755 diff --git a/settings/index.php b/settings/index.php index 5c3e00b..969a60e 100755 --- a/settings/index.php +++ b/settings/index.php @@ -5,7 +5,8 @@ session_start(); // Define settings file path - save in same directory as this file -$settings_file = __DIR__ . '/settings.json'; +$settings_file = 'settings.json'; +$logo_file = 'logo.png'; // Default settings $default_settings = [ @@ -55,10 +56,74 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $settings['frame_rate'] = $_POST['frame_rate'] ?? $settings['frame_rate']; $settings['gop'] = $_POST['gop'] ?? $settings['gop']; + // Handle logo upload + if (isset($_FILES['logo']) && $_FILES['logo']['error'] === UPLOAD_ERR_OK) { + // Check if GD library is available + if (!extension_loaded('gd')) { + $message = "GD library not available for image processing!"; + } else { + $allowed_types = ['image/png']; + $file_type = mime_content_type($_FILES['logo']['tmp_name']); + + if (in_array($file_type, $allowed_types)) { + // Move uploaded file + $target_path = $logo_file; + if (move_uploaded_file($_FILES['logo']['tmp_name'], $target_path)) { + // Process image with GD library to make it square + $image = imagecreatefrompng($target_path); + if ($image !== false) { + $width = imagesx($image); + $height = imagesy($image); + + // Calculate square dimensions (use smaller dimension) + $size = min($width, $height); + + // Create square canvas + $square = imagecreatetruecolor(128, 128); + + // Fill with transparent background + $transparent = imagecolorallocatealpha($square, 0, 0, 0, 127); + imagefill($square, 0, 0, $transparent); + + // Calculate position to center the image + $x = ($width - $size) / 2; + $y = ($height - $size) / 2; + + // Copy and resize to square + imagecopyresampled($square, $image, 0, 0, $x, $y, 128, 128, $size, $size); + + // Save the processed image + imagepng($square, $target_path); + + // Free memory + imagedestroy($image); + imagedestroy($square); + + $message = "Logo uploaded and processed successfully!"; + } else { + $message = "Error processing image with GD library!"; + } + } else { + $message = "Error uploading logo!"; + } + } else { + $message = "Only PNG images are allowed!"; + } + } + } + + // Handle logo removal + if (isset($_POST['remove_logo']) && $_POST['remove_logo'] == '1') { + if (file_exists($logo_file)) { + unlink($logo_file); + $message = "Logo removed successfully!"; + } + } + // Save settings to JSON file $settings_json = json_encode($settings, JSON_PRETTY_PRINT); if (file_put_contents($settings_file, $settings_json) !== false) { - $message = "Settings saved successfully!"; + $message .= " Settings saved successfully!"; } else { $message = "Error saving settings!"; } @@ -489,6 +554,95 @@ $_SESSION['settings'] = $settings; .btn-container { margin-top: 20px; } + + .logo-container { + text-align: center; + margin: 20px 0; + } + + .logo-preview { + width: 128px; + height: 128px; + margin: 0 auto; + border-radius: 0; /* Changed from 50% to 0 for square shape */ + overflow: hidden; + border: 2px solid rgba(92, 107, 192, 0.5); + box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); + background: rgba(13, 19, 33, 0.7); + display: flex; + justify-content: center; + align-items: center; + position: relative; + margin-bottom: 15px; + } + + .logo-preview img { + width: 100%; + height: 100%; + object-fit: contain; + display: block; + } + + .logo-preview .no-logo { + color: #4facfe; + font-size: 0.9rem; + text-align: center; + padding: 10px; + } + + .logo-actions { + display: flex; + justify-content: center; + gap: 10px; + margin-top: 10px; + } + + .logo-actions button { + padding: 8px 15px; + border: none; + border-radius: 8px; + cursor: pointer; + font-size: 0.9rem; + transition: all 0.3s; + } + + .upload-btn { + background: rgba(92, 107, 192, 0.3); + color: #4facfe; + } + + .remove-btn { + background: rgba(231, 76, 60, 0.3); + color: #e74c3c; + } + + .logo-actions button:hover { + transform: translateY(-2px); + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); + } + + .logo-preview::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border: 2px dashed rgba(92, 107, 192, 0.3); + border-radius: 50%; + pointer-events: none; + } + + /* Fix for logo preview */ + .logo-preview img { + display: block; + max-width: 100%; + max-height: 100%; + } + + .logo-preview img[src=""] { + display: none; + }
@@ -512,6 +666,34 @@ $_SESSION['settings'] = $settings; +Video format is limited to: MPEG-2, H.264, H.265, VP9, and AV1
@@ -582,5 +764,21 @@ $_SESSION['settings'] = $settings;Made with from ShreeBhattJi