fix update
This commit is contained in:
parent
6b478634a9
commit
22dd5c5c83
|
|
@ -11,7 +11,7 @@ https://github.com/shreebhatt_ji/Urmi/blob/main/licence.md
|
||||||
$json_file = '/var/www/html/app.json';
|
$json_file = '/var/www/html/app.json';
|
||||||
$error_message = '';
|
$error_message = '';
|
||||||
|
|
||||||
// --- 1. Handle Form Submission BEFORE any HTML is</em>
|
// --- 1. Handle Form Submission BEFORE any HTML is rendered ---
|
||||||
if (isset($_POST['submit'])) {
|
if (isset($_POST['submit'])) {
|
||||||
$upload_paths = [
|
$upload_paths = [
|
||||||
'app_ad' => '/var/www/html/app_ad.png',
|
'app_ad' => '/var/www/html/app_ad.png',
|
||||||
|
|
@ -30,7 +30,7 @@ if (isset($_POST['submit'])) {
|
||||||
unlink($path);
|
unlink($path);
|
||||||
// Also remove from encoder directory
|
// Also remove from encoder directory
|
||||||
$secondary_path = $secondary_dir . basename($path);
|
$secondary_path = $secondary_dir . basename($path);
|
||||||
if (file_exists($secondary_path)) unlink($secondary_path);
|
if (file_exists($secondary_path)) unlink($payload_path = $secondary_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +68,7 @@ if (isset($_POST['submit'])) {
|
||||||
|
|
||||||
// 6. Resize (Resample)
|
// 6. Resize (Resample)
|
||||||
imagecopyresampled(
|
imagecopyresampled(
|
||||||
$dest_img,
|
$dst_img,
|
||||||
$src_img,
|
$src_img,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
@ -82,7 +82,6 @@ if (isset($_POST['submit'])) {
|
||||||
|
|
||||||
// 7. Save to primary destination with compression (level 7)
|
// 7. Save to primary destination with compression (level 7)
|
||||||
if (imagepng($dst_img, $destination, 7)) {
|
if (imagepng($dst_img, $destination, 7)) {
|
||||||
// FIXED: Changed $int_name to $destination
|
|
||||||
$filename = basename($destination);
|
$filename = basename($destination);
|
||||||
$secondary_destination = $secondary_dir . $filename;
|
$secondary_destination = $secondary_dir . $filename;
|
||||||
|
|
||||||
|
|
@ -203,15 +202,15 @@ include 'header.php';
|
||||||
<div class="card wide">
|
<div class="card wide">
|
||||||
<h3 style="margin-bottom: 15px;">Upload Ad (PNG)</h3>
|
<h3 style="margin-bottom: 15px;">Upload Ad (PNG)</h3>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="file" name="app_ad" id="file_app_int" accept="image/png" style="color: white;">
|
<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'] != ''): ?>
|
<?php if (isset($_FILES['app_ad']) && $_FILES['app_ad']['tmp_name'] != ''): ?>
|
||||||
<div class="mt-2"><small style="color: #aaa;">New file selected (will upload on save)</small></div>
|
<div class="mt-2"><small style="color: #aaa;">New file selected (will upload on save)</small></div>
|
||||||
<?php elseif (file_exists('/var/www/html/app_ad.png')): ?>
|
<?php elseif (file_exists('/var/www/html/app_ad.png')): ?>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<small style="color: #aaa;">Current:</small><br>
|
<small style="color: #aaa;">Current:</small><br>
|
||||||
<img src="/app_ad.png" class="img-thumbnail" style="max-height: 60px; opacity: 0.7; margin-top: 5px;">
|
<img src="/app_ad.png" class="img-thumbnail" style="max-height: 60px; opacity: 0.7; margin-top: 5px;">
|
||||||
<button type="button" onclick="prepareRemoval('file_app_int', 'remove_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>
|
<button type="button" onclick="prepareRemoval('file_app_ad', 'remove_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>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -219,7 +218,7 @@ include 'header.php';
|
||||||
|
|
||||||
<!-- Upload Logo Section -->
|
<!-- Upload Logo Section -->
|
||||||
<div class="card wide">
|
<div class="card wide">
|
||||||
<h3 style="margin-bottom: 15px;">Upload Logo (PNG)</h3>
|
<h3 style="margin: 15px 0;">Upload Logo (PNG)</h3>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="file" name="app_logo" id="file_app_logo" accept="image/png" style="color: white;">
|
<input type="file" name="app_logo" id="file_app_logo" accept="image/png" style="color: white;">
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue