fix(og-image.php): re-use redirect logic + fix og image
This commit is contained in:
parent
5168b13c99
commit
13b5b9c5cb
4 changed files with 10 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require __DIR__ . '/../server/utils/init.php';
|
||||
|
||||
$id = $_GET['id'] ?? null;
|
||||
$class = $_GET['class'] ?? null;
|
||||
$extension = $_GET['extension'] ?? 'png';
|
||||
|
@ -24,12 +26,7 @@
|
|||
|
||||
curl_close($ch);
|
||||
|
||||
if ($httpCode !== 200 || $image === false || strpos($contentType, 'image/') !== 0) {
|
||||
error_log("Failed to fetch image: $cdnUrl ($httpCode - $contentType)");
|
||||
header("Location: /404", true, 302);
|
||||
|
||||
exit;
|
||||
}
|
||||
if ($httpCode !== 200 || $image === false || strpos($contentType, 'image/') !== 0) redirectTo404();
|
||||
|
||||
header("Content-Type: $contentType");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue