Zope3 photo album
Album est un produit simple d'album photo
pour Zope3.
Fonctionnalités
La création d'albums en tant que BTreeContainer
rapides en lecture/insertion/indexation
La création automatiques de miniatures portant
le même nom que les images originales, et la mise
à jour partielle de miniatures.
Téléchargement
Album nécessite PIL installé et est
disponible ici :
album.zip.
Utilisation
Ci dessous une utilisation possible :
- A utiliser tel quel pour un dossier contenant tous les albums
- Personnaliser les blocs 2 et/ou 3 pour un album unique inclus dans une page
- La fonction image_sets renvoie une liste de paquets de 5 photos
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="context/index.html/macros/master">
<body>
<div class='main' metal:fill-slot="main">
<!--
Prenons l'exemple d'un dossier /photos qui contient *plusieurs* albums :
Ce 1er bloc optionnel permet de faire une barre qui lie vers les albums
-->
<div class='albums_toolbar'>
<tal:block repeat="album context/photos/values">
<tal:block condition="exists: album/mini">
<a tal:attributes="href string:Photos.html?album=${album/__name__}"
tal:content="album/__name__" />
</tal:block>
</tal:block>
</div>
<!--
Ce 2eme bloc permet de presenter les photos d'un album
avec 5 photo par lignes (image_sets) et 4 lignes par page
(python:fullsets[page*4:(page+1)*4])
-->
<tal:block condition="exists: request/album">
<tal:block define="album python:context['photos'][request['album']]">
<table class='album'>
<tal:block define="fullsets album/image_sets;
pages python:(len(fullsets)+3)/4;
page python:'page' in request.keys() and int(request['page']) or 0;
sets python:fullsets[page*4:(page+1)*4]">
<tal:block repeat="set sets">
<tr>
<tal:block repeat="image set">
<!--
La partie interessante :
une photo en lien à partir de sa miniature
-->
<td>
<tal:block condition="image">
<a tal:attributes="href string:photos/${album/__name__}/${image/__name__}"><img tal:attributes="src string:photos/${album/__name__}/mini/${image/__name__}" /><br /><tal:block replace="image/__name__" /></a>
</tal:block>
</td>
</tal:block>
</tr>
</tal:block>
<tr>
<th colspan='4'>
<tal:block repeat="i python:range(pages)">
<a tal:attributes="href string:Photos.html?page=${i}&album=${album/__name__}" tal:content='python: i+1'/>
</tal:block>
</th>
</tr>
</tal:block>
</table>
</tal:block>
</tal:block>
</div>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="context/index.html/macros/master">
<body>
<div class='main' metal:fill-slot="main">
<!--
Prenons l'exemple d'un dossier /photos qui contient *plusieurs* albums :
Ce 1er bloc optionnel permet de faire une barre qui lie vers les albums
-->
<div class='albums_toolbar'>
<tal:block repeat="album context/photos/values">
<tal:block condition="exists: album/mini">
<a tal:attributes="href string:Photos.html?album=${album/__name__}"
tal:content="album/__name__" />
</tal:block>
</tal:block>
</div>
<!--
Ce 2eme bloc permet de presenter les photos d'un album
avec 5 photo par lignes (image_sets) et 4 lignes par page
(python:fullsets[page*4:(page+1)*4])
-->
<tal:block condition="exists: request/album">
<tal:block define="album python:context['photos'][request['album']]">
<table class='album'>
<tal:block define="fullsets album/image_sets;
pages python:(len(fullsets)+3)/4;
page python:'page' in request.keys() and int(request['page']) or 0;
sets python:fullsets[page*4:(page+1)*4]">
<tal:block repeat="set sets">
<tr>
<tal:block repeat="image set">
<!--
La partie interessante :
une photo en lien à partir de sa miniature
-->
<td>
<tal:block condition="image">
<a tal:attributes="href string:photos/${album/__name__}/${image/__name__}"><img tal:attributes="src string:photos/${album/__name__}/mini/${image/__name__}" /><br /><tal:block replace="image/__name__" /></a>
</tal:block>
</td>
</tal:block>
</tr>
</tal:block>
<tr>
<th colspan='4'>
<tal:block repeat="i python:range(pages)">
<a tal:attributes="href string:Photos.html?page=${i}&album=${album/__name__}" tal:content='python: i+1'/>
</tal:block>
</th>
</tr>
</tal:block>
</table>
</tal:block>
</tal:block>
</div>
</body>
</html>


-1°