- Image patch through Content-Type adjusting added

This commit is contained in:
Wiesner András 2024-10-09 21:04:56 +02:00
parent 821f31cd10
commit e2140d8dee
2 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,7 @@
"rakibtg/sleekdb": "2.15",
"ext-http": "*",
"ext-mbstring" : "*",
"ext-zip": "*"
"ext-zip": "*",
"ext-fileinfo": "*"
}
}

View File

@ -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);
}