PictureGallery

Summary: Picture viewer with thumbnails and comments option
Version: 4 (13 July 2006)
Prerequisites: Requires at least PmWiki version: 2.0; last tested on PmWiki version: 2.0.beta26
Status:
Maintainer:
Categories: Images

Questions answered by this recipe

Is there any possibility to let users leave comments for every single picture? Like a guestbook?

How can I add a picture viewer with thumbnails preview and automatically generated thumbnails to my wiki?

Answer

Download gallery4.phpΔ and copy it to cookbook/gallery.php

Add the following link into your config.php:

include_once("cookbook/gallery.php");

lines below just for portuguese translation Adicionar o seguinte link no config.php:

include_once("cookbook/dngallery_pt.php");

Upload the images you want in your gallery to PmWiki. Make sure all images have the prefix "gallery_".

To display the gallery, add the following line to any page within the group that you uploaded the images to:

(:gallery:).

Page Variables

{$GalleryCreationDate} - returns Date of creation
{$PhotoCount} - returns number of photos

Table around each thumbnail

I have a little modified the "gallery3.php"-cookbook. Now it generates a Table around each thumnail for better visibility

You can see an example on Table around thumb (Well, I see an error here... 404 Not found. A working example link is referenced and the bottom of the page... )

for Download: dngallery.phpΔ

Download in portuguese dngallery_pt.phpΔ and copy it to cookbook/dngallery_pt.php
Hope you can use it

Daniel

PageListTemplate Sample (version 2 of template)

If you want to use pagelists, you can create Site.LocalTemplates on your site and add this example to it: Please don't make linebreaks below - because then you will distroy this template!


fmt=#gallery

You need latest version of TotalCounter to show the calls.

[[#gallery]]
(:if equal {<$Group}:)
(:table width=100% :)
(:cell width=55%:)'''Gallery''' 
(:cell width=15% align=center:)'''Creation''' 
(:cell width=30% align=right:)'''Last Comment'''
(:if:)
(:cellnr:)[[{=$FullName}|'''{=$Titlespaced}''']] 
->(:if expr ! equal {=$PhotoCount} "0" && ! equal {=$PageViews} "":){=$PageViews} calls of (:ifend:)(:if ! equal {=$PhotoCount} "0" :) '''{=$PhotoCount}''' pictures, (:ifend:)(:if equal {=$PhotoCount} "0" :) '''Please upload pictures!''' (:ifend:)(:if expr ! equal {=$PostCount} "" && ! equal {=$PostCount} "1" :) '''{=$PostCount}''' comments(:ifend:)(:if equal {=$PostCount} "1" :) '''1''' comment(:ifend:)(:if equal {=$PostCount} "" :) no comments(:ifend:)
->{=$Description}
(:cell align=center:) {=$GalleryCreationDate}
(:cell align=right:) (:if ! equal {=$PostCount} "" :) [[~{=$LastModifiedBy}]] 
({=$LastModifiedDate}) (:ifend:)
(:if equal {>$Group}:)
(:tableend:)(:if:)
[[#gallery]]

Now if you are using group gallery for your gallery, you can use following command to list all pages:

(:pagelist fmt=Site.LocalTemplates#gallery name=Gallery.*  group=gallery list=normal:)

You can find a (German) example of this template at http://www.unet.univie.ac.at/~a0503736/php/floxwiki/pmwiki.php/Denk/Galerie [Bad link]

History

Notes and Comments

This script is based on the Cookbook Version 1 PictureGallery script by Stefan Jahn.

JPG, GIF and PNG-files will be accepted.

I don't think images need a prefix "gallery_", but a prefix of the pagename in lowercase letters like "pagename_". If the gallery markup is inserted in page Photos.FirstAlbum for instance the prefix should be "firstalbum_". - But even then the gallery still does not work for me. It does not recognise existing images, and the upload images url is wrong as it contains a <a href=...> tag in itself. HansB

Sorry about my late response. I have rewritten PictureGallery for PmWiki 2.0 and i have fixed some bugs in the script. Look at Picture Gallery Homesite for more information. Sorry, the site is only in german. I name the new script here gallery2.php

gallery2.phpΔ sorry, I destroyed it, please upload it again! flox July 13, 2006, at 06:40 AM

Hello Jeff, thank you for your work. Please, can you tidy up this site. Thank You.

StefanJahn


June 6, 2005

I have made a change to gallery2.php and called it gallery3.phpΔ I added support for a file in the directory of pictures called <suffix>_.txt which contains a description of each picture, one on a line. First line corresponds to first picture, second line corresponds to the second picture and so on. I added this because not all pictures will have the IPTC Caption in them. The description lines will show up as Title text in the thumbnail images and will be used in place of IPTC Caption on the full image display.

Chris -> mailto:ccox [snail] airmail [period] net


November 26, 2005

The script does not differ between portrait and landscape oriented pictures. To change this behavior search in gallery[x].php for the line:

        $newwidth = 100;

(in gallery3.php it's line 192) and change it to

        if ($width > $height) $newwidth = 160; else $newwidth = 120;

or whatever values your thumbnaild should have. newmy


There is a problem - file names with " " (space) aren't supported. Also if someone doesn't upload with ".jpg", it is recognize.

I am too busy to work on this problem... :-(

flox May 15, 2006, at 01:38 AM


See Also

EmbeddedGallery
SimpleGallery
SimpleImageFloat?
Category: Images

Contributors

Questions and Request

  • Is there a version of this PictureGallery that will work on my PmWiki version

pmwiki-2.1.beta10

Thanks Dhing

Tested gallery4.php with pmwiki-2.2.0-beta30 and it works.

Additional information:

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.