Compare commits

..

34 Commits

Author SHA1 Message Date
Devdatt Bhatt 6ed9904c3d content_type 2026-05-20 20:52:08 +00:00
Devdatt Bhatt 500f3a7041 update 2026-05-20 20:20:15 +00:00
Devdatt Bhatt 36e37edd8a content_type 2026-05-20 20:09:10 +00:00
Devdatt Bhatt 8f7edf49f5 <!-- Content Details --> 2026-05-20 20:00:35 +00:00
Devdatt Bhatt a2c31e27d9 content_rating 2026-05-20 19:56:54 +00:00
Devdatt Bhatt 288254d45c @header only style 2026-05-20 19:48:04 +00:00
Devdatt Bhatt fdfab0b162 update 2026-05-20 19:47:20 +00:00
Devdatt Bhatt 52c5581ffa updated file 2026-05-20 19:34:06 +00:00
Devdatt Bhatt 10df5dc62f Syntext Error 2026-05-20 14:55:34 +00:00
Devdatt Bhatt 7d13740033 json update 2026-05-20 14:54:32 +00:00
Devdatt Bhatt bf5b07ac12 content rating updated 2026-05-20 14:45:53 +00:00
Devdatt Bhatt 7122ad7455 ratings and other things added 2026-05-20 14:40:42 +00:00
Devdatt Bhatt ed0f037533 dual input removed 2026-05-20 12:59:39 +00:00
Devdatt Bhatt 71d2dfeee7 update 2026-05-20 12:45:39 +00:00
Devdatt Bhatt 22dd5c5c83 fix update 2026-05-20 12:39:03 +00:00
Devdatt Bhatt 6b478634a9 update 2026-05-20 12:34:02 +00:00
Devdatt Bhatt b05bc7e933 updtae 2026-05-20 12:30:40 +00:00
Devdatt Bhatt c3153e58c7 logo update 2026-05-20 12:14:55 +00:00
Devdatt Bhatt 2b150db94d update 2026-05-20 12:05:06 +00:00
Devdatt Bhatt 3a68ba0feb update 2026-05-20 11:53:01 +00:00
Devdatt Bhatt e8dd03fdae json update 2026-05-20 10:40:18 +00:00
Devdatt Bhatt c0fbc53920 update 2026-05-20 10:16:49 +00:00
Devdatt Bhatt add6a67a79 update post 2026-05-20 10:13:31 +00:00
Devdatt Bhatt c823673ef3 update 2026-05-20 10:02:16 +00:00
Devdatt Bhatt a571b64521 update 2026-05-20 08:50:36 +00:00
Devdatt Bhatt 0788206700 update 2026-05-20 08:42:27 +00:00
Devdatt Bhatt 8b549657b5 update 2026-05-20 08:36:54 +00:00
Devdatt Bhatt 5edf91fd1f updtae 2026-05-20 08:26:07 +00:00
Devdatt Bhatt 36a713952f lable update 2026-05-20 08:23:35 +00:00
Devdatt Bhatt 0c2ff83685 update 2026-05-20 08:20:38 +00:00
Devdatt Bhatt 6e21e4b49e app 2026-05-20 08:14:40 +00:00
Devdatt Bhatt 9afdd245d2 update 2026-05-20 08:11:07 +00:00
Devdatt Bhatt 51388255cc updtae 2026-05-20 08:08:35 +00:00
Devdatt Bhatt 4ad484ddd3 update 2026-05-20 08:03:56 +00:00
2 changed files with 312 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Urmi Universal Encoder Decoder ( INTELQSV ) Urmi Universal Encoder Decoder ( INTELQSV )
---------------------------------------- ----------------------------------------
H264 - H265 Encoder H264 - H265 - Encoder/Decoder
HLS - DASH - RTMP - SRT - UDP - HTTPS - FFMPEG Output Support HLS - DASH - RTMP - SRT - UDP - HTTPS - FFMPEG Output Support
Instalation Instalation

311
encoder/app.php Normal file
View File

@ -0,0 +1,311 @@
<?php
/*
Urmi you happy me happy licence
Copyright (c) 2026 shreebhattji
License text:
https://github.com/shreebhatt_ji/Urmi/blob/main/licence.md
*/
$json_file = '/var/www/html/app.json';
$error_message = '';
// --- 1. Handle Form Submission BEFORE any HTML is rendered ---
if (isset($_POST['submit'])) {
$upload_paths = [
'app_ad' => '/var/www/html/app_ad.png',
'app_logo' => '/var/www/html/app_logo.png'
];
$secondary_dir = '/var/www/encoder/';
$errors = [];
// Handle File Deletions
$to_delete = $_POST['remove_files'] ?? [];
foreach ($to_delete as $file_key => $should_delete) {
if ($should_delete === '1' && isset($upload_paths[$file_key])) {
$path = $upload_paths[$file_key];
if (file_exists($path)) {
unlink($path);
// Also remove from encoder directory
$secondary_path = $secondary_dir . basename($path);
if (file_exists($secondary_path)) {
unlink($secondary_path);
}
}
}
}
foreach ($upload_paths as $input_name => $destination) {
if (isset($_FILES[$input_name]) && $_FILES[$input_name]['error'] == 0) {
$tmp_path = $_FILES[$input_name]['tmp_name'];
// 1. Verify it is actually a PNG using GD/getimagesize
$image_info = @getimagesize($tmp_path);
if (!$image_info || $image_info[2] !== IMAGETYPE_PNG) {
$errors[] = "File for $input_name must be a valid PNG image.";
continue;
}
// 2. Determine target dimensions
$target_width = ($input_name === 'app_logo') ? 128 : 256;
$target_height = ($input_name === 'app_logo') ? 128 : 256;
// 3. Load the source image
$src_img = @imagecreatefrompng($tmp_path);
if (!$src_img) {
$errors[] = "Failed to process $input_name (Invalid PNG data).";
continue;
}
// 4. Create a blank truecolor canvas
$dst_img = imagecreatetruecolor($target_width, $target_height);
// 5. Preserve transparency for PNG
imagealphablending($dst_img, false);
imagesavealpha($png_alpha = $dst_img, true);
$transparent = imagecolorallocatealpha($dst_img, 255, 255, 255, 127);
imagefill($dst_img, 0, 0, $transparent);
// 6. Resize (Resample)
imagecopyresampled(
$dst_img,
$src_img,
0,
0,
0,
0,
$target_width,
$target_height,
imagesx($src_img),
imagesy($src_img)
);
// 7. Save to primary destination with compression (level 7)
if (imagepng($dst_img, $destination, 7)) {
$filename = basename($destination);
$secondary_destination = $secondary_dir . $filename;
if (!copy($destination, $secondary_destination)) {
$errors[] = "Failed to create secondary copy for $input_name.";
}
} else {
$errors[] = "Failed to save processed $input_name.";
}
imagedestroy($src_img);
imagedestroy($dst_img);
}
}
// Handle Text Fields
$text_fields = [
'channel_name',
'office_address',
'contact_details',
'enforcement_officer',
'eo_contact_details',
'company_name',
'cin_number',
'gstin_number',
'content_type',
'content_rating',
'content_language'
];
$data_to_save = [];
foreach ($text_fields as $field) {
$data_to_save[$field] = $_POST[$field] ?? '';
}
// Save if no errors occurred
if (empty($errors)) {
file_put_contents($json_file, json_encode($data_to_save, JSON_PRETTY_PRINT));
header("Location: " . $_SERVER['PHP_SELF']);
exit;
} else {
$error_message = implode("<br>", $errors);
}
}
// --- 2. Load Data for Display ---
$saved_data = [];
if (file_exists($json_file)) {
$json_content = file_get_contents($json_file);
$saved_data = json_decode($json_content, true) ?? [];
}
function getValue($data, $key)
{
return $data[$key] ?? '';
}
include 'header.php';
?>
<script>
function prepareRemoval(inputId, removeInputId, previewImgId) {
document.getElementById(inputId).value = "";
document.getElementById(removeInputId).value = "1";
const imgElement = document.getElementById(previewImgId);
if (imgElement) {
imgElement.style.display = 'none';
const btn = imgElement.nextElementSibling;
if (btn && btn.tagName === 'BUTTON') btn.style.display = 'none';
}
const container = document.getElementById(inputId).parentElement;
const label = container.querySelector('small');
if (label) {
label.innerText = "File marked for removal";
label.style.color = "#ff4d4d";
}
}
</script>
<div class="containerindex">
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="remove_files[app_ad]" id="remove_app_ad" value="">
<input type="hidden" name="remove_files[app_logo]" id="remove_app_logo" value="">
<div class="grid">
<h2>Company Information Entry</h2>
<?php if (!empty($error_message)): ?>
<div style="background: #ff0000; color: white; padding: 15px; border-radius: 6px; margin-bottom: 20px; grid-column: span 2;">
<?php echo $error_message; ?>
</div>
<?php endif; ?>
<!-- Company Details -->
<div class="card wide">
<h3>General Details</h3>
<div class="grid">
<div class="input-wrap">
<div class="input-group">
<input type="text" name="channel_name" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'channel_name')); ?>" required>
<label>Channel Name</label>
</div>
<div class="input-group">
<input type="text" name="office_address" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'office_address')); ?>" required>
<label>Office Address</label>
</div>
</div>
<div class="input-wrap">
<div class="input-group">
<input type="text" name="contact_details" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'contact_details')); ?>" required>
<label>Contact Details</label>
</div>
<div class="input-group">
<input type="text" name="enforcement_officer" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'enforcement_officer')); ?>" required>
<label>Enforcement Officer</label>
</div>
</div>
</div>
<div class="grid">
<div class="input-group">
<input type="text" name="eo_contact_details" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'eo_contact_details')); ?>" required>
<label>EO Contact Details</label>
</div>
<div class="input-group">
<input type="text" name="company_name" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'company_name')); ?>" required>
<label>Company Name</label>
</div>
</div>
<div class="grid">
<div class="input-group">
<input type="text" name="cin_number" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'cin_number')); ?>">
<label>CIN Number</label>
</div>
<div class="input-group">
<input type="text" name="gstin_number" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'gstin_number')); ?>">
<label>GSTIN Number</label>
</div>
</div>
</div>
<div class="card wide">
<h3>Content Details</h3>
<div class="grid">
<div class="dropdown-container">
<span class="dropdown-label">Content Rating</span>
<div class="dropdown">
<select name="content_rating" id="content_rating">
<?php
$ratings = ['U' => 'Universal', 'UA' => 'Parental Guidance', 'A' => 'Adults Only', 'S' => 'Special'];
foreach ($ratings as $code => $desc) {
$selected = (getValue($saved_data, 'content_rating') === $code) ? 'selected' : '';
echo "<option value=\"$code\" $selected>$code ($desc)</option>";
}
?>
</select>
</div>
</div>
<div class="dropdown-container">
<span class="dropdown-label">Content Type</span>
<div class="dropdown">
<select name="content_type" id="content_type">
<?php
$ratings = [];
foreach ($ratings as $desc) {
$selected = (getValue($saved_data, 'content_type') === $code) ? 'selected' : '';
echo "<option value=\"$code\" $selected>$desc</option>";
}
?>
</select>
</div>
</div>
<div class="input-group">
<input type="text" name="content_type" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'content_type')); ?>" required>
<label>Content Type</label>
</div>
<br>
<div class="input-group">
<input type="text" name="content_language" placeholder=" " value="<?php echo htmlspecialchars(getValue($saved_data, 'content_language')); ?>" required>
<label>Content Language</label>
</div>
</div>
</div>
<!-- Upload Ad Section -->
<div class="card">
<h3>Upload Ad (PNG)</h3>
<div class="input-group">
<input type="file" name="app_ad" id="file_app_ad" accept="image/png" style="color: white;">
<?php if (isset($_FILES['app_ad']) && $_FILES['app_ad']['tmp_name'] != ''): ?>
<div class="mt-2"><small style="color: #aaa;">New file selected</small></div>
<?php elseif (file_exists('/var/www/html/app_ad.png')): ?>
<div class="mt-2">
<img src="/app_ad.png" id="preview_app_ad" class="img-thumbnail" style="max-height: 60px; opacity: 0.7;">
<button type="button" onclick="prepareRemoval('file_app_ad', 'remove_app_ad', 'preview_app_ad')" style="background:none; border:none; color:#ff4d4d; cursor:pointer; font-size:12px; text-decoration:underline; display:block; margin-top:5px;">Remove Existing</button>
</div>
<?php endif; ?>
</div>
</div>
<!-- Upload Logo Section -->
<div class="card">
<h3>Upload Logo (PNG)</h3>
<div class="input-group">
<input type="file" name="app_logo" id="file_app_logo" accept="image/png" style="color: white;">
<?php if (isset($_FILES['app_logo']) && $_FILES['app_logo']['tmp_name'] != ''): ?>
<div class="mt-2"><small style="color: #aaa;">New file selected</small></div>
<?php elseif (file_exists('/var/www/html/app_logo.png')): ?>
<div class="mt-2">
<img src="/app_logo.png" id="preview_app_logo" class="img-thumbnail" style="max-height: 60px; opacity: 0.7;">
<button type="button" onclick="prepareRemoval('file_app_logo', 'remove_app_logo', 'preview_app_logo')" style="background:none; border:none; color:#ff4d4d; cursor:pointer; font-size:12px; text-decoration:underline; display:block; margin-top:5px;">Remove Existing</button>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div style="text-align:center; width:100%; margin: 40px 0;">
<button type="submit" name="submit" style="background:#c00;color:#fff;padding:15px 80px;border:none;font-weight:bold;border-radius:6px;cursor:pointer;font-size:18px; transition: 0.3s;">Save All Details</button>
</div>
</form>
</div>
<?php include 'footer.php'; ?>