Librairie Lightbox v2

Retour à la liste des scripts
Informations LIGHTBOX - version 2 - 16.08.2008
Auteur : Julien Theler - www.twiip.ch
Contact :
Licence : CC-by-nc [Ne pas supprimer ou modifier la notification de parternité dans les commentaires des fichiers]
Fichiers La librairie contient 6 fichiers indispensables :
lightboxClass.php (télécharger) : Contient les constantes de configuration, une fonction pour l'appel en AJAX et la class Lightbox
lightbox.js (télécharger) : Contient le code javascript composé de variables globales et de fonctions
lightbox.css (télécharger) : Contient le CSS des différents éléments HTML utilisés
loader.gif (télécharger) : Image affichée lors du préchargement des images
arrowleft.png (télécharger) : Flèche de navigation entre les images
arrowright.png (télécharger) : Flèche de navigation entre les images
white.png (télécharger) : Image blanche affichée lors de l'agrandissement

1. Configuration Trois constantes doivent être configurées dans le fichier lightbox.php (trois premières lignes du code) :
MAXWIDTH -> Largeur maximale des images (les images plus grandes sont redimensionnées, les proportions sont conservées) et largeur par défaut des box contenant du texte
MAXHEIGHT -> Hauteur maximale des images (les images plus grandes sont redimensionnées, les proportions sont conservées)
LIGHTBOXPATH -> Chemin absolu du répertoire de la librairie depuis la racine (ex : /dossier/lightbox/)
2. Mise en place Le fichier lightbox.php contenant la class Lightbox doit être inclu de la façon suivante avant l'utilisation des lightbox :
require_once($_SERVER['DOCUMENT_ROOT'].'[/chemin/chemin]/lightbox.php');
3. Création d'un objet Lightbox L'objet Lightbox doit être créé pour pouvoir générer des lightbox. Sa création insère les fichiers nécessaires (lightbox.css et lightbox.js) ainsi que les div utilisées par la librairie.
$lb = new Lightbox();
4. Fonctions d'affichage d'une image Affichage d'un lien ouvrant une image : function lightboxImage(string lien, string image, [string titre])

Exemple :

echo $lb->lightboxImage('<img src="'.$miniature.'" border="0" />', $image);

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/2.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21
Affichage d'une miniature générée ouvrant une image : function lightboxImageMini(string image, [int widthMini], [int heightMini], [string titre])

Exemple :

echo $lb->lightboxImageMini('/images/image.jpg', 200, null, 'Ceci est un titre');

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/8.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21
5. Fonctions d'affichage d'une série d'images Affichage d'un lien ouvrant une série d'images : function lightboxImageArray(string lien, array images, [int position], [array titres])

Exemple :

echo $lb->lightboxImageArray('<img src="'.$miniature.'" border="0" />', $array, 0);

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/1.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21
Affichage d'une miniature générée ouvrant une série d'images : function lightboxImageArrayMini(string image, array images, [int position], [int widthMini], [int heightMini], [string titre])

Exemple :

echo $lb->lightboxImageArrayMini($image, $array, 0, null, 150, $array_titres);

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images2/1.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21
6. Fonctions d'affichage d'un texte Affichage d'un texte : lightboxContenu(string lien, string contenu, [int width], [string titre])

Exemple :

echo $lb->lightboxContenu('lien', $contenu);
petit texte, grand texte avec image

7. Exemple d'utilisation de la librairie pour afficher une galerie
Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/1.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/2.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/3.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/4.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/5.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/6.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/7.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21

Warning: getimagesize(http://dev.twiip.ch/scripts/ressources/images/8.jpg): failed to open stream: no suitable wrapper could be found in /home/clients/ea7c959d9c8a630663d0f6bbfcca20a9/twiip.ch/subdomains/dev/httpdocs/scripts/lightbox/lightboxClass.php on line 21