diff --git a/AUTHORS b/AUTHORS index 286ee85..a9e5b7e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,3 +9,10 @@ P:Simon E:contact@leblanc-simon.eu D:2007-12 C:internationalisation, limitation items RSS, bugfixes + +N:Guillaume Duhamel +P:Guill +E:guillaume.duhamel@gmail.com +D:2008-05 +C:Galerie de vignettes + diff --git a/RELEASE b/RELEASE index 574ad52..71481d9 100644 --- a/RELEASE +++ b/RELEASE @@ -1,4 +1,5 @@ SVN : +* ajout d'une vue en vignettes * possibilité d'ajouter des commentaires avec PunBB (http://www.punbb.org) * légères modifications du template diff --git a/configuration-dist.php b/configuration-dist.php index f92f2dd..44b522f 100644 --- a/configuration-dist.php +++ b/configuration-dist.php @@ -87,6 +87,11 @@ class configuration * HTML template to use */ var $template_html = 'template_default.html'; + + /** + * Number of thumbnails per gallery page + */ + var $thumbs_per_page = 5; } ?> diff --git a/gallery.php b/gallery.php new file mode 100644 index 0000000..c2196e8 --- /dev/null +++ b/gallery.php @@ -0,0 +1,120 @@ + +* @license http://www.gnu.org/licenses/gpl.html GPL +* @copyright 2007 Johann Dréo +* +* @package stripit +*/ + +set_include_path(get_include_path() . PATH_SEPARATOR . getcwd()); + +require_once 'strip_manager.php'; +require_once 'configuration.php'; + +// hack for passing objects by values instead of reference under PHP5 (but not PHP4) +// damn clone keyword ! +if (version_compare(phpversion(), '5.0') < 0) { + eval('function clone($object) {return $object;}'); +} + +/** +* Gallery manager +*/ +class gallery_manager +{ + /** + * Items list + * @var array + */ + var $items_list = array(); + + /** + * Configuration + * @var array + */ + var $general; + + var $nav_base_url = "gallery.php?page="; + + /** + * Constructor + * + * Use the {@link strip_manager} to do the stuff, and convert date from the iso8601 to RFC822 format. + */ + function gallery_manager() { + + //$this->general = new configuration; + + $sm = new strip_manager(); + + $this->general = $sm->general; + $this->lang = $sm->lang; + + $sm->strips_list_get(); + + // limit the number of strips in Gallery + $limit = $this->general->thumbs_per_page; + if (isset($_GET['limit']) && is_numeric($_GET['limit'])) { + $limit = $_GET['limit']; + + if ($limit <= 0) { + $limit = $this->general->thumbs_per_page; + } + } + + $lastpage = intval(($sm->strips_count - 1) / $limit); + + if( !isset($_GET['page']) || $_GET['page'] == '' || !is_numeric($_GET['page']) ) { + $element_asked = 0; + } else { + $element_asked = $_GET['page']; + + if ($element_asked < 0) { + $element_asked = 0; + } + + if ($element_asked > $lastpage) { + $element_asked = $lastpage; + } + } + + $start = $element_asked * $limit; + $end = $start + $limit; + + if ($end > $sm->strips_count) { + $end = $sm->strips_count; + } + + for( $i = $start; $i < $end; $i++ ) { + $sm->strip_info_get( $i ); + + $this->items_list[] = clone($sm); // hack for php4/5 compat + } + + $this->nav_prev = $this->nav_base_url . ($element_asked - 1) . "&limit=$limit"; + $this->nav_next = $this->nav_base_url . ($element_asked + 1) . "&limit=$limit"; + $this->nav_last = $this->nav_base_url . $lastpage . "&limit=$limit"; + $this->nav_first = $this->nav_base_url . "&limit=$limit"; + } + + /** + * Generate the Gallery output with the template engine. + */ + function generate() { + $sm = new strip_manager; + $output = new HTML_Template_Flexy($sm->options); + $output->compile('template_gallery_default.html'); + $output->outputObject($this,$this->items_list); + } +} + +/** +* Instanciation and output. +*/ +$gallerym = new gallery_manager(); +$gallerym->generate(); + +?> diff --git a/strip_manager.php b/strip_manager.php index 8f4a22f..0524d29 100644 --- a/strip_manager.php +++ b/strip_manager.php @@ -80,6 +80,10 @@ class strip_manager * URL of the displayed file */ var $img_src =''; + /** + * URL of the thumbnail + */ + var $thumbnail =''; /** * Title */ @@ -260,6 +264,7 @@ class strip_manager // change the extension for {@link $img_src} $png = explode( '.', $file); $this->img_src = $this->strips_path.'/'.$png[0].'.png'; + $this->thumbnail = $this->strips_path.'/'.$png[0].'.thumb.png'; $this->source = $svg; diff --git a/stripit.py b/stripit.py index 9f353dc..6672ecd 100755 --- a/stripit.py +++ b/stripit.py @@ -252,6 +252,19 @@ class Stripit: if self.verbose: print '\tok' + # generation de la miniature pour la galerie + if self.verbose: + print '\tCreating the thumbnail PNG from the SVG...', + sys.stdout.flush() + + cmd = 'inkscape -z --export-width=345 --export-png %s.thumb.png %s.svg ' % (file_we,file_we) + cmd += options + + os.popen( cmd ) + + if self.verbose: + print '\tok' + def xfind( self, tree, ns ): # on ne veut passer qu'un liste d'élements diff --git a/style_default.css b/style_default.css index d9a0f9a..123700c 100644 --- a/style_default.css +++ b/style_default.css @@ -55,6 +55,11 @@ a:hover { width:100%; } +.stripbox { + border:1px solid black; + background-color:white; +} + #strip { border:1px solid black; background-color:white; diff --git a/template_gallery_default.html b/template_gallery_default.html new file mode 100644 index 0000000..35fb950 --- /dev/null +++ b/template_gallery_default.html @@ -0,0 +1,58 @@ + + + + + + + {general.title} - {title} + + + + + + + + + + + + +
+ +
+ +{foreach:items_list,id,strip} +
+
+ +
+
+{end:} + +
+

{lang.forum}

+

{comments:h}

+

{lang.forum_new}

+

{lang.boutique} {general.title} {lang.teeshirt}.

+ {lang.see_also} + +

{lang.propulse} Strip-It, {lang.descstrip} ({general.version}).

+
+ + + + +