Skip to content
Extraits de code Groupes Projets
Valider 053e3a8b rédigé par cerdic's avatar cerdic Validation de Gitea
Parcourir les fichiers

support de webp sur la fonction chemin_image() aussi et amelioration de formats_image_acceptables()

parent b7f1c2f7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -1477,7 +1477,7 @@ function chemin_image($icone) {
}
// si c'est un nom d'image complet (article-24.png) essayer de le renvoyer direct
if (preg_match(',[.](png|gif|jpg|svg)$,', $icone) and $f = find_in_theme("images/$icone")) {
if (preg_match(',[.](png|gif|jpg|webp|svg)$,', $icone) and $f = find_in_theme("images/$icone")) {
return $f;
}
// sinon passer par le module de renommage
......@@ -3427,17 +3427,30 @@ function html5_permis() {
* @param bool $svg_allowed
* @return array
*/
function formats_image_acceptables($gd = false, $svg_allowed = true) {
$config = ($gd ? "gd_formats" : "formats_graphiques");
$formats = (isset($GLOBALS['meta'][$config]) ? $GLOBALS['meta'][$config] : 'png,gif,jpg');
$formats = explode(',', $formats);
$formats = array_filter($formats);
$formats = array_map('trim', $formats);
function formats_image_acceptables($gd = null, $svg_allowed = true) {
$formats = null;
if (!is_null($gd)) {
$config = ($gd ? "gd_formats" : "formats_graphiques");
if (isset($GLOBALS['meta'][$config])) {
$formats = $GLOBALS['meta'][$config];
$formats = explode(',', $formats);
$formats = array_filter($formats);
$formats = array_map('trim', $formats);
}
}
if (is_null($formats)) {
include_spip('inc/filtres_images_lib_mini');
$formats = _image_extensions_acceptees_en_entree();
}
if ($svg_allowed) {
$formats[] = 'svg';
if (!in_array('svg', $formats)) {
$formats[] = 'svg';
}
}
else {
$formats = array_diff($formats, ['svg']);
}
return $formats;
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter