<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $file = $_POST['file'] ?? ''; if (!$file) { echo '<div class="alert-error"><span>No file specified.</span></div>'; return; } $base = basename($file); $uploadDir = realpath(DASHBOARD_ROOT . '/../uploads'); $target = realpath($uploadDir . '/' . $base); if (!$uploadDir || !$target || strpos($target, $uploadDir) !== 0 || !file_exists($target)) { echo '<div class="alert-error"><span>File not found.</span></div>'; return; } $ext = strtolower(pathinfo($target, PATHINFO_EXTENSION)); if (!in_array($ext, ['jpg','jpeg','png','gif','webp'], true)) { echo '<div class="alert-error"><span>Invalid file type.</span></div>'; return; } try { require_once DASHBOARD_ROOT . '/core/image_process.php'; ImageProcess::stripMetadata($target); echo '<div class="alert-success"><span>EXIF data stripped successfully.</span></div>'; } catch (\Throwable $e) { echo '<div class="alert-error"><span>' . UI::e($e->getMessage()) . '</span></div>'; }
