From 3ad2be78af6f8411b274c7a0264b91f1b0d5f2e4 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Sat, 2 Oct 2004 22:13:38 +0000 Subject: [PATCH] petit bug (on n'est plus en PHP3, Arnaud), et encore moins de IMG --- ecrire/inc_logos.php3 | 52 ++++++++++++++--------------------------- spip_image_reduite.php3 | 7 +++--- 2 files changed, 21 insertions(+), 38 deletions(-) diff --git a/ecrire/inc_logos.php3 b/ecrire/inc_logos.php3 index 9f83e736de..4826f20e5a 100644 --- a/ecrire/inc_logos.php3 +++ b/ecrire/inc_logos.php3 @@ -7,25 +7,33 @@ define("_ECRIRE_INC_LOGOS", "1"); global $flag_ecrire; define('_DIR_IMG', ($GLOBALS['flag_ecrire'] ? "../" : "")."IMG/"); -function get_image($racine) { +function decrire_logo($racine) { + global $connect_id_auteur; + foreach (array('gif','jpg','png') as $fmt) { $fichier = "$racine.".$fmt; $fid = _DIR_IMG . $fichier; if (@file_exists($fid)) { - $limage = @getimagesize( _DIR_IMG . $fichier); - // contrer le cache du navigateur - if ($fid = @filesize($fid) . @filemtime($fid)) - $fid = "&".md5($fid); + $contre = @filesize($fid) . @filemtime($fid); + if ($taille = @getimagesize($fid)) { + list($x, $y, $w, $h) = resize_logo($taille); + $xy = "$x x $y "._T('info_pixels'); + $taille = " width='$w' height='$h'"; + } else { $xy =''; $w = 0; $h = 0;} return array($fichier, - (!$limage ? '' : resize_logo($limage)), - $fid); - } + $xy, + "<img src='../spip_image_reduite.php3?img=" . + $fid . "&taille_x=$w&taille_y=$h&hash=" . + calculer_action_auteur ("reduire $w $h") . + "&hash_id_auteur=$connect_id_auteur" . + (!$contre ? '' : ("&".md5($contre))) . + "'$taille alt='' />"); + } } return ''; } - function resize_logo($limage, $maxi=190) { $limagelarge = $limage[0]; @@ -73,31 +81,6 @@ function afficher_boite_logo($logo, $survol, $texteon, $texteoff) { } } -function decrire_logo($racine) { - global $connect_id_auteur; - $logo = get_image($racine); - if ($logo) { - $taille = $logo[1]; - if ($taille) { - list($x, $y, $w, $h) = $taille; - $logo[1] = "$x x $y "._T('info_pixels'); - $taille = " width='$w' height='$h'"; - } - - $hash = calculer_action_auteur ("reduire $w $h"); - - $logo[2] = "<img src='../spip_image_reduite.php3?img=" . - _DIR_IMG . $logo[0]. "&taille_x=$w&taille_y=$h&hash=$hash&hash_id_auteur=$connect_id_auteur" . $logo[2] . - "'$taille alt='' />"; - -/* $logo[2] = "<img src='" . - _DIR_IMG . $logo[0] . $logo[2] . - "'$taille alt='' />"; - -*/ - } - return $logo; -} function afficher_logo($racine, $titre, $logo) { global $id_article, $coll, $id_breve, $id_auteur, $id_mot, $id_syndic, $connect_id_auteur; @@ -116,6 +99,7 @@ function afficher_logo($racine, $titre, $logo) { if ($logo) { list($fichier, $taille, $img) = $logo; + spip_log("$fichier, $taille, $img"); $hash = calculer_action_auteur("supp_image $fichier"); echo "<p><center>$img"; diff --git a/spip_image_reduite.php3 b/spip_image_reduite.php3 index ef7a32f986..e78c6ef33b 100644 --- a/spip_image_reduite.php3 +++ b/spip_image_reduite.php3 @@ -3,15 +3,14 @@ //$img = "IMG/rubon0.png"; $img = $_GET['img']; $logo = $img; - -if (!$taille_y) - $taille_y = $taille_x; - include ("ecrire/inc_version.php3"); include_local("inc-public-global.php3"); include_ecrire("inc_admin.php3"); +if (!$taille_y) + $taille_y = $taille_x; + if (ereg("^../",$logo)) $logo = substr($logo,3); -- GitLab