feat(galerias): accept JPEG XL photos and list every uploaded format
This commit is contained in:
1 parent
14dbabcad5
commit
7fa2da73dc
5 files changed
+9
-8
No files matched your search
@@ -55,7 +55,7 @@ function db_gallery_image_upload(PDO $pdo, int $gallery_id, array $file): ?strin
|
||||
|
||||
if (($file['size'] ?? 0) > 16 * 1024 * 1024) return null;
|
||||
// Tipo decidido pelo conteúdo, não pelo nome (config/functions_images.php).
|
||||
$ext = upload_image_ext($file, ['jpg', 'jpeg', 'png', 'gif', 'webp']);
|
||||
$ext = upload_image_ext($file, ['jpg', 'jpeg', 'png', 'gif', 'webp', 'jxl']);
|
||||
if ($ext === null) return null;
|
||||
|
||||
$upload_dir = __DIR__ . '/../uploads/gallery/' . $gallery_id . '/';
|
||||
@@ -66,7 +66,7 @@ function db_gallery_image_upload(PDO $pdo, int $gallery_id, array $file): ?strin
|
||||
img_optimize($upload_dir . $filename, IMG_MAX_GALLERY);
|
||||
|
||||
$stmt = $pdo->prepare("INSERT INTO gallery (i_file_name, i_file_type, i_project_id) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$filename, $file['type'] ?? 'image/jpeg', $gallery_id]);
|
||||
$stmt->execute([$filename, $ext === 'jxl' ? 'image/jxl' : ($file['type'] ?? 'image/jpeg'), $gallery_id]);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user