From e2140d8dee8831bbc11dc64b7cd9806508c68da0 Mon Sep 17 00:00:00 2001 From: Epagris Date: Wed, 9 Oct 2024 21:04:56 +0200 Subject: [PATCH] - Image patch through Content-Type adjusting added --- composer.json | 3 ++- interface.php | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5efc9e0..0bd6d47 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,7 @@ "rakibtg/sleekdb": "2.15", "ext-http": "*", "ext-mbstring" : "*", - "ext-zip": "*" + "ext-zip": "*", + "ext-fileinfo": "*" } } \ No newline at end of file diff --git a/interface.php b/interface.php index 3f6095b..0d54229 100644 --- a/interface.php +++ b/interface.php @@ -286,9 +286,12 @@ function patch_through_image(string $gameid, string $img_url) $image_fetch_url = $game_dir . DIRECTORY_SEPARATOR . $img_url; $img_fp = fopen($image_fetch_url, "r"); + $content_type = mime_content_type($image_fetch_url); if ($img_fp === false) { $img_fp = fopen(MISSING_IMAGE_PLACEHOLDER, "r"); + $content_type = mime_content_type(MISSING_IMAGE_PLACEHOLDER); } + header("Content-Type: $content_type"); fpassthru($img_fp); fclose($img_fp); }