Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

SimpleGallery

Summary: A simple image gallery
Version:
Prerequisites:
Status:
Maintainer:
Categories: Images

Simple Picture Gallery

From time to time I shoot some pictures. Holidays, rowing events the usual snapshot stuff, no world press photo for me. Still I want to show them to the world

There are a lot of fancy gallery programs. There is another cookbook about integration of one of them into pmwiki. This one is very K.I.S.S.. It uses the wiki itself for comments. And it allows hosting the image files on a different host as the wiki. (This is the main reason why I ever bothered about writing my own gallery-script)

I would like to share the bits of code although it is quite ugly. Comments for improvements are welcome I will try to tidy the code.

Installation

  • Download the file simplegallery.phpΔ and add it to the (farm)config.php
  • The image files are uploaded using ftp to a server somewhere.
  • Create a configuration-page e.q. GalleryName/Config.. See the parameters section below
  • Add a list of images
    • image1.jpg:some fancy description
    • image2.jpg:description
  • Create a GalleryName/HomePage
  • Create a groupheader GalleryName/GroupHeader, add
(:Gallery GalleryName.Config:)
  • Consider protecting the GalleryName/Config and GalleryName/GroupHeader for writing.
  • After saving the header page the gallery should show up.

Each image will show on a single page, users can edit this page to add comments. Since the Gallery directive is in the groupheader there is no need to create every single page in advance. Pages that do not match a image file name will show the thumbnail index.

Parameters

Each on a line, using a bullet * makes reading easier

Title

some fancy name for your gallery.
default: Gallery

Location

  • Full URL to the location of the files e.q.
    • http://server_path/directory_path/
  • Attach:

No default value

Maxcol

maximum numbers of columns on a page.
default: 5
There is no control to limit the number of rows, simply create two galleries to split a large amount of pictures

Thumb

Prefix for the thumb files. Can be a directory or filename.
default: thumb/

Width

Width of the thumbnails
default: 144px

Height

Height of the thumbnails
default: 108px

Limit

Number of Thumbnails per page
default: 25

Notes

  • You could write the Configurations into a different group
    • Galleries/GalleryName1
    • Galleries/GalleryName2
    • etc
    Then in GalleryName1/GroupHeader
    (:Gallery Galleries.GalleryName1:)
Benefit would be read/write access restrictions
  • Use Location:Attach: and something like Thumb:tn_, to upload files and thumbnailes
  • Use Thumb: to use the big files as thumbnailes. The css will crunch them but users still download the large files.
  • Use (:nogroupheader:) to disable the display of the index on selected pages.
  • Instead of GroupHeader GroupFooter can be used as well of course.
  • There is no need for the image files to be on the same server as pmwiki. I use free hosts for the files.

Constraints

  • All files for a gallery must be in a single directory.
  • Thumbnails must be pre-generated.
  • Image names must differ case-insensitive, thus foo.jpg and Foo.jpg are not allowed together in one gallery.
  • Image names must differ on character and numbers, thus foo_bar.jpg and foobar.jpg are not allowed together in one gallery.
  • Image names my not match the DefaultName ( HomePage on a default installation)

Bugs

  • Only jpg supported.
  • Partial image name matching is not handled well: image names foo.jpg and foobar.jpg will create chaos.

Examples

Using the Attach: Location

Using a remote Location

Comments

  • This is a horribly written recipe... imposible to follow. Please consider revising!
  • Sorry, but i understand nothing! Can you give an example from the pages please. Thanks

Where does the confusion start? Above are some links with examples, including the syntax. Feel free to email me, my cloacked address is at the bottom of the example pages ( Contact )

This would be sweet if the script could automatically generate the wikitext list of images - all the user would have to do is upload files and describe them. - Sproaticus September 13, 2005, at 12:11 PM

Use Attach: as location en use the image pages to upload. Still using FTP is a lot easier faster....

BrBrBr

  • SimpleGallery could be used with folders created with any script gallery and I would like to use different galleries whitch use themselves differents thumbs extension (_ThumB_, th, thumb, etc.)

So It would be fine to have multiple Prefix in the SimpleGallery config. Any body an idea of how to do this? thanks ed

Put Thumb:prefix_ in the Gallery.Config page (with Title:titleofyourgallery, Location:[(approve links) edit diff], and the list of the files)
Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM