diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 734a0603825..314953c2ed4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Cédric GROSS * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019-2023 Thibault Foucart * Copyright (C) 2020 Open-Dsi * Copyright (C) 2021 Gauthier VERDOL @@ -13594,7 +13594,7 @@ function dolIsAllowedForPreview($file) } // Check mime types - $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'webp', 'webm', 'mp4'); + $mime_preview = array('avif', 'bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'webp', 'webm', 'mp4'); if (getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_IMAGES')) { $mime_preview[] = 'svg+xml'; } @@ -13875,6 +13875,10 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $mime = 'video/webm'; $imgmime = 'video.png'; $famime = 'file-video'; + } elseif (preg_match('/\.avif$/i', $tmpfile)) { + $mime = 'image/avif'; + $imgmime = 'image.png'; + $famime = 'file-image'; } elseif (preg_match('/\.avi$/i', $tmpfile)) { $mime = 'video/x-msvideo'; $imgmime = 'video.png'; diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 44e4ee3cba5..ad07d9aa0e4 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -1,8 +1,8 @@ - * Copyright (C) 2005-2007 Regis Houssin - * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,6 +121,9 @@ function image_format_supported($file, $acceptsvg = 0) if (strtolower($reg[1]) == '.svg') { $imgfonction = 'imagecreatefromsvg'; // Never available } + if (strtolower($reg[1]) == '.avif') { + $imgfonction = 'imagecreatefromavif'; // PHP >= 8.1 + } if ($imgfonction) { if (!function_exists($imgfonction)) { // Functions of conversion not available in this PHP