diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php index fc1fe7c6a38fe28aa19d324592059631d3496657..ef9180977bef69d66025e534a33b4755bd8b4ad3 100644 --- a/ecrire/inc/filtres.php +++ b/ecrire/inc/filtres.php @@ -3347,10 +3347,17 @@ function http_img_pack($img, $alt, $atts = '', $title = '', $options = array()) * * @param string $img * @param string $att + * @param string $size * @return string */ -function http_style_background($img, $att = '') { - return " style='background" . ($att ? "" : "-image") . ": url(\"" . chemin_image($img) . "\")" . ($att ? (' ' . $att) : '') . ";'"; +function http_style_background($img, $att = '', $size=null) { + if ($size and is_numeric($size)){ + $size = trim($size) . "px"; + } + return " style='background" . + ($att ? "" : "-image") . ": url(\"" . chemin_image($img) . "\")" . ($att ? (' ' . $att) : '') . ";" + . ($size ? "background-size:{$size};" : '') + . "'"; } /** @@ -3916,7 +3923,7 @@ function prepare_icone_base($type, $lien, $texte, $fond, $fonction = "", $class // 2 images pour composer l'icone : le fond (article) en background, // la fonction (new) en image $icone = http_img_pack($fonction, $alt, "width='$size' height='$size'\n" . - http_style_background($fond)); + http_style_background($fond, '', $size)); } else { $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); } diff --git a/ecrire/inc/pipelines.php b/ecrire/inc/pipelines.php index 412472fab26c359636c5d42dc2db108aa739ab55..41ac32b8ddec95151e58882c7f4bed0df3d3e26c 100644 --- a/ecrire/inc/pipelines.php +++ b/ecrire/inc/pipelines.php @@ -199,7 +199,7 @@ function f_admin($texte) { if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and $GLOBALS['html']) { include_spip('inc/filtres'); // pour http_img_pack $x = "<div class='spip-previsu' " - . http_style_background('preview-32.png') + . http_style_background('preview-32.png', '', 32) . ">" . _T('previsualisation') . "</div>"; diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php index fc3e5928394018e35338e0feca901aec76b6fae2..41ed6dd24ac18b66cf4ba2e53ab839e8f88bdd60 100644 --- a/ecrire/inc/presentation.php +++ b/ecrire/inc/presentation.php @@ -61,7 +61,7 @@ function debut_cadre($style, $icone = "", $fonction = "", $titre = "", $id = "", // 2 images pour composer l'icone : le fond (article) en background, // la fonction (new) en image $icone = http_img_pack($fonction, "", "class='cadre-icone' width='$size' height='$size'\n" . - http_style_background($fond, "no-repeat center center")); + http_style_background($fond, "no-repeat center center", $size)); } else { $icone = http_img_pack($fond, "", "class='cadre-icone' width='$size' height='$size'"); }