From 485b61991a0f233f6cb3568567172a7fe4110e90 Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:49:54 +0300 Subject: [PATCH] Update Compress.php --- app/Controllers/Api/Images/Compress.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Api/Images/Compress.php b/app/Controllers/Api/Images/Compress.php index ca21955..d299b10 100644 --- a/app/Controllers/Api/Images/Compress.php +++ b/app/Controllers/Api/Images/Compress.php @@ -78,7 +78,14 @@ class Compress { if ($compressed_image_data) { file_put_contents($cache_filename, $compressed_image_data); } else { - echo "Произошла ошибка при сжатии изображения."; + $imageData = file_get_contents($_GET['url']); + + $finfo = new \finfo(FILEINFO_MIME_TYPE); + $mimeType = $finfo->buffer($imageData); + + header("Content-Type: $mimeType"); + + echo $imageData; exit; } }