diff --git a/dist/article.html b/dist/article.html index 0b0393097000ce761f3a0dddb9026a4227a8aa6e..0f07507839341e16b83006a2e1425dae8659a9fb 100644 --- a/dist/article.html +++ b/dist/article.html @@ -120,7 +120,7 @@ <div class="cartouche"> #DEBUT_SURLIGNE[ -(#LOGO_ARTICLE|left)][ +(#LOGO_ARTICLE|left||reduire_image{120,120})][ <div class="surtitre">(#SURTITRE)</div> ]<h1 class="titre-texte">#TITRE</h1>[ <div class="surtitre">(#SOUSTITRE)</div> @@ -202,7 +202,7 @@ <div><hr> <BOUCLE_documents_portfolio(DOCUMENTS){id_article}{mode=document}{fichier==(png|jpg|gif)$}{doublons}> <div style="float: left;"> - [<a href="#URL_ARTICLE[(#URL_ARTICLE|strpos{'?'}|?{'&','?'})]id_document=#ID_DOCUMENT">(#LOGO_DOCUMENT||reduire_image{1000,52})</a>][<div><b>(#TITRE)</b></div>][<div>(#DESCRIPTIF)</div>] + [<a href="#URL_ARTICLE[(#URL_ARTICLE|strpos{'?'}|?{'&','?'})]id_document=#ID_DOCUMENT">(#FICHIER|reduire_image{1000,52})</a>][<div><b>(#TITRE)</b></div>][<div>(#DESCRIPTIF)</div>] </div> </BOUCLE_documents_portfolio> </div> diff --git a/ecrire/config-fonctions.php3 b/ecrire/config-fonctions.php3 index 8429c258080121c771506e6c52105d6255834836..c5b16f9f5777d280511f94ae7d7d4c870847474b 100644 --- a/ecrire/config-fonctions.php3 +++ b/ecrire/config-fonctions.php3 @@ -156,6 +156,17 @@ else { } + // + // Pour test pendant devel, possibilite de desactiver + // + + if ($image_process == "non") { + ecrire_meta("formats_graphiques", ""); + ecrire_metas(); + } + echo "<p>[$image_process / $formats_graphiques]<a href='config-fonctions.php3?image_process=non'>Aucune méthode</a></p>"; + + // // Une fois le process choisi, proposer vignettes // diff --git a/ecrire/inc_documents.php3 b/ecrire/inc_documents.php3 index e56a0eda94fbe21a06f506ca48ae25a1a932929b..f97b9d441bd1cf3f0721fd2ffa499a4d4927c72a 100644 --- a/ecrire/inc_documents.php3 +++ b/ecrire/inc_documents.php3 @@ -605,18 +605,27 @@ entites_html($document['fichier'])."\" />\n"; // // Recuperer la vignette et afficher le doc // - if ($id_vignette AND - $vignette = spip_fetch_array(spip_query("SELECT * FROM spip_documents WHERE id_document = $id_vignette"))) { - $fichier_vignette = generer_url_document($id_vignette); - $largeur_vignette = $vignette['largeur']; - $hauteur_vignette = $vignette['hauteur']; - $taille_vignette = $vignette['taille']; - echo texte_vignette_document($largeur_vignette, $hauteur_vignette, $fichier_vignette, $url); - } - else { - echo document_et_vignette($url, $document['id_type']); + if ($album == 'portfolio') { + // En mode portfolio, on ne travaille pas avec les vignettes + // (sinon, pas de squelette possible) + echo reduire_image_logo(_DIR_PREFIX1."$fichier", 120); + } else { + if ($id_vignette AND + $vignette = spip_fetch_array(spip_query("SELECT * FROM spip_documents WHERE id_document = $id_vignette"))) { + $fichier_vignette = generer_url_document($id_vignette); + $largeur_vignette = $vignette['largeur']; + $hauteur_vignette = $vignette['hauteur']; + $taille_vignette = $vignette['taille']; + + echo texte_vignette_document($largeur_vignette, $hauteur_vignette, $fichier_vignette, $url); + } + else { + echo document_et_vignette($url, $document['id_type']); + } } + + echo "</div>"; // fin du bloc vignette + rotation @@ -712,6 +721,15 @@ entites_html($document['fichier'])."\" />\n"; echo "</form>"; + if ($album != 'portfolio') { + // bloc mettre a jour la vignette + // (pas de vignette en portfolio) + echo "<hr />"; + bloc_gerer_vignette($document, $image_url, $redirect_url, $album); + } + + echo "</div>"; + // bouton "supprimer le doc" $link_supp = new Link ($image_url); $link_supp->addVar('redirect', $redirect_url); @@ -723,12 +741,6 @@ entites_html($document['fichier'])."\" />\n"; icone_horizontale(_T('icone_supprimer_document'), $link_supp->getUrl(), "image-24.gif", "supprimer.gif"); - - // bloc mettre a jour la vignette - echo "<hr />"; - bloc_gerer_vignette($document, $image_url, $redirect_url, $album); - - echo "</div>"; } // fin block modifs diff --git a/ecrire/inc_logos.php3 b/ecrire/inc_logos.php3 index cfc78c1473f8686a1c822f8156b858b8ecca07d2..f43a304c42cfe145b5063824845a31e7ac89b962 100644 --- a/ecrire/inc_logos.php3 +++ b/ecrire/inc_logos.php3 @@ -18,7 +18,8 @@ define("_ECRIRE_INC_LOGOS", "1"); function cherche_image_nommee($nom, $formats = array ('gif', 'jpg', 'png')) { - if (ereg("^../",$nom)) $nom = substr($nom,3); + // _DIR_IMG contient deja le ../ dans ecrire (PREFIX1 + // if (ereg("^../",$nom)) $nom = substr($nom,3); if (ereg("^" . _DIR_IMG, $nom)) { $nom = substr($nom,strlen(_DIR_IMG)); } @@ -33,7 +34,9 @@ function cherche_image_nommee($nom, $formats = array ('gif', 'jpg', 'png')) { reset($formats); while (list(, $format) = each($formats)) { $d = _DIR_IMG . "$chemin$nom.$format"; - if (@file_exists($d)) return array(_DIR_IMG."$chemin", $nom, $format); + if (@file_exists($d)){ + return array(_DIR_IMG."$chemin", $nom, $format); + } } } @@ -136,7 +139,7 @@ function afficher_logo($racine, $titre, $logo, $id_objet, $id) { list($fichier, $taille, $img) = $logo; $hash = calculer_action_auteur("supp_logo $fichier"); - echo "<p><center><div>$img</div>"; + echo "<p><center><div><a href='"._DIR_IMG.$fichier."'>".reduire_image_logo(_DIR_IMG.$fichier, 170)."</a></div>"; echo debut_block_invisible(md5($titre)); echo $taille; echo "\n<br />[<a href='../spip_image.php3?"; @@ -390,6 +393,8 @@ function creer_vignette($image, $maxWidth, $maxHeight, $format, $destdir, $destf $retour['height'] = $hauteur = $size[1]; $retour['fichier'] = $vignette; $retour['format'] = $format; + $retour['date'] = filemtime($vignette); + // renvoyer l'image return $retour; @@ -437,7 +442,7 @@ function reduire_image_logo($img, $taille = 120, $taille_y=0) { $taille_y = $taille; // recuperer le nom du fichier - if (eregi("src='([^']+)'", $img, $regs)) $logo = $regs[1]; + if (eregi("img src=['\"]([^'\"]+)['\"]", $img, $regs)) $logo = $regs[1]; if (!$logo) $logo = $img; $attributs = ''; @@ -466,11 +471,13 @@ function reduire_image_logo($img, $taille = 120, $taille_y=0) { $vignette = $preview['fichier']; $width = $preview['width']; $height = $preview['height']; - return "<img src='$vignette' width='$width' height='$height'$attributs />"; + $date = $preview['date']; + return "<img src='$vignette?date=$date' width='$width' height='$height'$attributs />"; } else if ($taille_origine = @getimagesize($logo)) { + $date = filemtime($logo); list ($destWidth,$destHeight) = image_ratio($taille_origine[0], $taille_origine[1], $taille, $taille_y); - return "<img src='$logo' width='$destWidth' height='$destHeight'$attributs />"; + return "<img src='$logo?date=$date' width='$destWidth' height='$destHeight'$attributs />"; } } } diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 3ac8371a8a8152bd5d04ff456aebf779226d32b5..54894dea4ab998725dd5b75c47f9ae5b8bc06d70 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -816,8 +816,12 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a if ($spip_display != 1 AND $spip_display != 4 AND lire_meta('image_process') != "non") { include_ecrire("inc_logos.php3"); $logo = decrire_logo("arton$id_article"); - if ($logo) { + if ($logo) { $fichier = $logo[0]; + $s .= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>"; + $s .= reduire_image_logo(_DIR_IMG.$fichier, 26, 20); + $s .= "</div>"; + /* $taille = $logo[1]; $taille_x = $logo[3]; $taille_y = $logo[4]; @@ -829,7 +833,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a $s.= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'> <img src='../spip_image_reduite.php3?img="._DIR_IMG."$fichier&taille_x=$w&taille_y=$h&hash=$hash&hash_id_auteur=$connect_id_auteur' alt='$fichier' width='$w' height='$h' border='0'></div>"; - + */ } } @@ -949,6 +953,11 @@ function afficher_breves($titre_table, $requete, $affrub=false) { $logo = decrire_logo("breveon$id_breve"); if ($logo) { $fichier = $logo[0]; + $s .= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>"; + $s .= reduire_image_logo(_DIR_IMG.$fichier, 26, 20); + $s .= "</div>"; + +/* $taille = $logo[1]; $taille_x = $logo[3]; $taille_y = $logo[4]; @@ -960,7 +969,7 @@ function afficher_breves($titre_table, $requete, $affrub=false) { $s.= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'> <img src='../spip_image_reduite.php3?img="._DIR_IMG."$fichier&taille_x=$w&taille_y=$h&hash=$hash&hash_id_auteur=$connect_id_auteur' alt='$fichier' width='$w' height='$h' border='0'></div>"; - +*/ } } diff --git a/ecrire/inc_rubriques.php3 b/ecrire/inc_rubriques.php3 index 73d3249769e37509b36093e105a045b7a1879120..141d885a4612b38398e5599caa1c840c815076d1 100644 --- a/ecrire/inc_rubriques.php3 +++ b/ecrire/inc_rubriques.php3 @@ -267,6 +267,11 @@ function enfant_rub($collection){ $logo = decrire_logo("rubon$id_rubrique"); if ($logo) { $fichier = $logo[0]; + $les_enfants .= "<div style='float: $spip_lang_right; margin-$spip_lang_right: -6px; margin-top: -6px;'>"; + $les_enfants .= reduire_image_logo(_DIR_IMG.$fichier, 48, 36); + $les_enfants .= "</div>"; + + /* $taille_x = $logo[3]; $taille_y = $logo[4]; $taille = image_ratio($taille_x, $taille_y, 48, 36); @@ -276,6 +281,7 @@ function enfant_rub($collection){ $hash = calculer_action_auteur ("reduire $w $h"); $les_enfants.= "<img src='../spip_image_reduite.php3?img="._DIR_IMG."$fichier&taille_x=$w&taille_y=$h&hash=$hash&hash_id_auteur=$connect_id_auteur' width='$w' height='$h' align='$spip_lang_right' style='margin-$spip_lang_right: -6px; margin-top: -6px;' />"; + */ } }