Rev 609 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of wikini. |
// | |
// | wikini is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | wikini is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* wikini - galerie.php
*
* Description :
*
*@package wikini
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 1999-2007
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Définition de constantes
define('DS', DIRECTORY_SEPARATOR);
/** Constante "dynamique" stockant le chemin absolue de base de l'application recherche de plante.*/
define('GAL_CHEMIN_APPLI', dirname(realpath(__FILE__)).DS);
/** Constante "dynamique" stockant le chemin relatif de base de l'application recherche de plante.*/
define('GAL_CHEMIN_APPLI_RELATIF', str_replace($_SERVER['DOCUMENT_ROOT'], '', GAL_CHEMIN_APPLI));
// Initialisation des variables
$sortie = '';
$GLOBALS['_GALLERIE_']['erreur'] = '';
// Inclusion du fichier de config de l'action
require_once GAL_CHEMIN_APPLI.'configuration'.DS.'gal_config.inc.php';
//+----------------------------------------------------------------------------------------------------------------+
// Récupération des paramêtres et gestion des erreurs de paramètrage
if (!$this->GetParameter('dossier')) {
$options['dossier'] = null;
$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le paramètre 'dossier' est obligatoire !";
} else {
$options['dossier'] = $this->GetParameter('dossier');
}
if (!$this->GetParameter('id')) {
$options['id'] = microtime();
//$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le paramètre 'id' est obligatoire !";
} else {
$options['id'] = $this->GetParameter('id');
}
if (!$this->GetParameter('largeur')) {
$options['largeur'] = 160;
} else {
$options['largeur'] = $this->GetParameter('largeur');
}
if (!$this->GetParameter('hauteur')) {
$options['hauteur'] = 160;
} else {
$options['hauteur'] = $this->GetParameter('hauteur');
}
if (!isset($options['qualite'])) {
$options['qualite'] = 70;
}
if (!isset($options['img_largeur'])) {
$options['img_largeur'] = 800;
}
if (!isset($options['img_hauteur'])) {
$options['img_hauteur'] = 600;
}
if (!isset($options['img_qualite'])) {
$options['img_qualite'] = 70;
}
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
//+----------------------------------------------------------------------------------------------------------------+
// Récupération des données
$noimage = 0;
$GLOBALS['_GALERIE_']['id'] = $options['id'];
$GLOBALS['_GALERIE_']['dossier'] = GAL_CHEMIN_RACINE.$options['dossier'];
if (is_dir($GLOBALS['_GALERIE_']['dossier'])) {
if ($dh = opendir($GLOBALS['_GALERIE_']['dossier'])) {
while (($f = readdir($dh)) !== false) {
if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
$noimage++;
$images[] = array('filename' => $f, 'hauteur' => $h, 'largeur' => $w);
array_multisort($images, SORT_ASC, SORT_REGULAR);
}
}
closedir($dh);
}
} else {
$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALERIE_']['dossier'];
}
if($noimage) {
$GLOBALS['_GALERIE_']['css']['chemin'] = GAL_CHEMIN_STYLES_RELATIF;
$GLOBALS['_GALERIE_']['css']['largeur'] = $options['largeur'];
$GLOBALS['_GALERIE_']['script']['chemin'] = GAL_CHEMIN_SCRIPTS_RELATIF;
$GLOBALS['_GALERIE_']['images'] = array();
foreach($images as $image) {
if ($image['filename'] != '') {
$aso_img['fichier_nom'] = $image['filename'];
$aso_img['url_img'] = 'http://'.$_SERVER['HTTP_HOST'].GAL_CHEMIN_SCRIPTS_RELATIF.'showthumb.php?img='.urlencode(GAL_CHEMIN_RACINE.$options['dossier'].DS.$image['filename']).'&width='.$options['img_largeur'].'&height='.$options['img_hauteur'].'&quality='.$options['img_qualite'];
$aso_img['url_img_mini'] = 'http://'.$_SERVER['HTTP_HOST'].GAL_CHEMIN_SCRIPTS_RELATIF.'showthumb.php?img='.urlencode(GAL_CHEMIN_RACINE.$options['dossier'].DS.$image['filename']).'&width='.$options['img_largeur'].'&height='.$options['img_hauteur'].'&quality='.$options['qualite'];
$GLOBALS['_GALERIE_']['images'][] = $aso_img;
}
}
}
//+----------------------------------------------------------------------------------------------------------------+
// Gestion des squelettes
// Extrait les variables et les ajoutes à l'espace de noms local
extract($GLOBALS['_GALERIE_']);
// Démarre le buffer
ob_start();
// Inclusion du fichier
include GAL_CHEMIN_SQUELETTE.GAL_SQUELETTE_LISTE;
// Récupérer le contenu du buffer
$sortie = ob_get_contents();
// Arrête et détruit le buffer
ob_end_clean();
//+----------------------------------------------------------------------------------------------------------------+
// Sortie
echo $sortie;
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>