Beispiel #1
0
function vignette_automatique($img, $doc, $lien, $x = 0, $y = 0, $align = '', $class = 'spip_logos')
{
    include_spip('inc/distant');
    include_spip('inc/texte');
    include_spip('inc/filtres_images_mini');
    $e = $doc['extension'];
    if (!$img) {
        if ($img = image_du_document($doc)) {
            if (!$x and !$y) {
                // eviter une double reduction
                $img = image_reduire($img);
            }
        } else {
            $f = charger_fonction('vignette', 'inc');
            $img = $f($e, false);
            $size = @getimagesize($img);
            $img = "<img src='{$img}' " . $size[3] . " />";
        }
    } else {
        $size = @getimagesize($img);
        $img = "<img src='{$img}' " . $size[3] . " />";
    }
    // on appelle image_reduire independamment de la presence ou non
    // des librairies graphiques
    // la fonction sait se debrouiller et faire de son mieux dans tous les cas
    if ($x or $y) {
        $img = image_reduire($img, $x, $y);
    }
    $img = inserer_attribut($img, 'alt', '');
    $img = inserer_attribut($img, 'class', $class);
    if ($align) {
        $img = inserer_attribut($img, 'align', $align);
    }
    if (!$lien) {
        return $img;
    }
    $titre = supprimer_tags(typo($doc['titre']));
    $titre = " - " . taille_en_octets($doc['taille']) . ($titre ? " - {$titre}" : "");
    $type = sql_fetsel('titre, mime_type', 'spip_types_documents', "extension = " . sql_quote($e));
    $mime = $type['mime_type'];
    $titre = attribut_html(couper($type['titre'] . $titre, 80));
    return "<a href='{$lien}' type='{$mime}' title='{$titre}'>{$img}</a>";
}
Beispiel #2
0
/**
 * fonction appelee par la balise #LOGO_DOCUMENT
 *
 * http://code.spip.net/@calcule_logo_document
 *
 * @param array $row
 * @param string $connect
 * @return bool|string
 */
function quete_logo_file($row, $connect = null)
{
    include_spip('inc/documents');
    $logo = vignette_logo_document($row, $connect);
    if (!$logo) {
        $logo = image_du_document($row);
    }
    if (!$logo) {
        $f = charger_fonction('vignette', 'inc');
        $logo = $f($row['extension'], false);
    }
    // si c'est une vignette type doc, la renvoyer direct
    if (strcmp($logo, _DIR_PLUGINS) == 0 or strcmp($logo, _DIR_PLUGINS_DIST) == 0 or strcmp($logo, _DIR_RACINE . 'prive/') == 0) {
        return $logo;
    }
    return get_spip_doc($logo);
}
Beispiel #3
0
function quete_logo_file($row, $connect=NULL) {
	include_spip('inc/documents');
	$logo = vignette_logo_document($row, $connect);
	if (!$logo) $logo = image_du_document($row);
	if (!$logo){
		$f = charger_fonction('vignette','inc');
		$logo = $f($row['extension'], false);
	}
	if (preg_match(',^'._DIR_IMG_ICONES_DIST.',', $logo))
		return $logo;
	return get_spip_doc($logo);
}