@@ -236,10 +236,10 @@ include 'header.php';
@@ -250,11 +250,11 @@ include 'header.php';
Content Type
@@ -304,7 +304,7 @@ include 'header.php';
-
-
+
+
\ No newline at end of file
diff --git a/encoder/image.php b/encoder/image.php
index f6d53f5..1409102 100644
--- a/encoder/image.php
+++ b/encoder/image.php
@@ -12,10 +12,12 @@ $json_file = '/var/www/html/app.json';
$error_message = '';
// --- 1. Handle Form Submission BEFORE any HTML is rendered ---
-if (isset($_POST['submit'])) {
+if (isset($_POST['submit']) || isset($_POST['display'])) {
$upload_paths = [
'app_ad' => '/var/www/html/app_ad.png',
- 'app_logo' => '/var/www/html/app_logo.png'
+ 'app_logo' => '/var/www/html/app_logo.png',
+ 'vertical_ad' => '/var/www/html/vertical_ad.png',
+ 'horizontal_ad' => '/var/www/html/horizontal_ad.png'
];
$secondary_dir = '/var/www/encoder/';
@@ -48,8 +50,16 @@ if (isset($_POST['submit'])) {
continue;
}
- $target_width = ($input_name === 'app_logo') ? 128 : 256;
- $target_height = ($input_name === 'app_logo') ? 128 : 256;
+ // Define dimensions based on input name
+ $dimensions = [
+ 'app_logo' => [128, 128],
+ 'app_ad' => [256, 256],
+ 'vertical_ad' => [650, 850],
+ 'horizontal_ad' => [1920, 230]
+ ];
+
+ $target_width = $dimensions[$input_name][0];
+ $target_height = $dimensions[$input_name][1];
// 3. Load the source image
$src_img = @imagecreatefrompng($tmp_path);
@@ -64,7 +74,7 @@ if (isset($_POST['submit'])) {
// 5. Preserve transparency for PNG
imagealphablending($dst_img, false);
imagesavealpha($dst_img, true);
- $transparent = imagecolorallocatealpha($dst_img, 255, 255, 255, 127);
+ $transparent = imagecolorallocatealpha($dst_img, 0, 0, 0, 127);
imagefill($dst_img, 0, 0, $transparent);
// 6. Resize (Resample)
@@ -83,10 +93,10 @@ if (isset($_POST['submit'])) {
// 7. Save to primary destination with compression (level 7)
if (imagepng($dst_img, $destination, 7)) {
- $filename = basename($destination);
+ $filename = basename($to_destination);
$secondary_destination = $secondary_dir . $filename;
- if (!copy($destination, $secondary_destination)) {
+ if (!@copy($destination, $secondary_destination)) {
$errors[] = "Failed to create secondary copy for $input_name.";
}
} else {
@@ -129,10 +139,32 @@ include 'header.php';
}
-