feat(gyms): show gym logos in navbar buttons and brand; accept JPEG XL uploads
This commit is contained in:
1 parent
a85bec6851
commit
d445ba64b9
7 files changed
+51
-18
No files matched your search
@@ -39,6 +39,15 @@ function upload_image_ext(array $file, array $allowed): ?string {
|
||||
}
|
||||
$raster = ['image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif', 'image/webp' => 'webp'];
|
||||
|
||||
// JPEG XL: o getimagesize()/GD não o conhecem e o finfo só nas versões
|
||||
// recentes, por isso vê-se pela assinatura (codestream FF 0A ou contentor
|
||||
// ISOBMFF "JXL "). Só entra onde quem chama pôs 'jxl' em $allowed; o
|
||||
// img_optimize() salta-o (não há GD para JXL).
|
||||
if (in_array('jxl', $allowed, true)) {
|
||||
$head = (string) @file_get_contents($tmp, false, null, 0, 12);
|
||||
if (str_starts_with($head, "\xFF\x0A") || $head === "\x00\x00\x00\x0CJXL \x0D\x0A\x87\x0A") return 'jxl';
|
||||
}
|
||||
|
||||
if (isset($raster[$mime]) || $mime === '') {
|
||||
$info = @getimagesize($tmp);
|
||||
$ext = $info ? ($raster[$info['mime']] ?? null) : null;
|
||||
|
||||
Reference in new issue
Block a user