<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $file = $_POST['file'] ?? ''; $targetWidth = (int)($_POST['width'] ?? 800); $targetHeight = (int)($_POST['height'] ?? 800); if (!$file) { echo '<div class="alert-error"><span>No file specified.</span></div>'; return; } if (!file_exists($file)) { echo '<div class="alert-error"><span>File not found.</span></div>'; return; } try { require_once DASHBOARD_ROOT . '/core/image_process.php'; ImageProcess::resize($file, $targetWidth, $targetHeight); [$w, $h] = getimagesize($file); echo '<div class="alert-success"><span>Resized to ' . (int)$w . 'x' . (int)$h . '</span></div>'; echo '<div class="preview"><div class="card-img" style="background-image:url(\'' . UI::e($file) . '\')"></div></div>'; } catch (\Throwable $e) { echo '<div class="alert-error"><span>' . UI::e($e->getMessage()) . '</span></div>'; } 