ZenGallery: a minimalist image gallery for Orchard

The gallery, added to a commerce siteThere are quite a few image gallery modules for Orchard but they were not invented here I wanted something a lot less sophisticated that would be as barebones and minimalist as possible out of the box, to make customization extremely easy. So I made this, in less than two days (during which I got distracted a lot).

Nwazet.ZenGallery uses existing Orchard features as much as it can:

  • Galleries are just a content part that can be added to any type
  • The set of photos in a gallery is simply defined by a folder in Media
  • Managing the images in a gallery is done using the standard media management from Orchard
  • Ordering of photos is simply alphabetical order of the filenames (use 1_, 2_, etc. prefixes if you have to)
  • The path to the gallery folder is mapped from the content item using a token-based pattern
  • The pattern can be set per content typeSetting the pattern
  • You can edit the generated gallery path for each itemEditing the path
  • The default template is just a list of links over images, that get open in a new tab
  • No lightbox script comes with the module, just customize the template to use your favorite script.Using a lightbox script
  • Light, light, light.The gallery displays thumbnails in admin summary view

Rather than explaining in more details this very simple module, here is a video that shows how I used the module to add photo galleries to a product catalog:

Adding a gallery to a product catalog

You can find the module on the Orchard Gallery:
https://gallery.orchardproject.net/List/Modules/Orchard.Module.Nwazet.ZenGallery/

The source code is available from BitBucket:
https://bitbucket.org/bleroy/nwazet.zengallery

5 Comments

  • Great module, I love that it is a minimalist approach. In order to utilize the module on Azure I had to change one line of your code (and hope you might add it to your source). In ZenGalleryService.cs line 100 you have this:

    return _mediaService
    .GetMediaFiles(physPath)
    .OrderBy(p => p.Name)
    .Select(p => _mediaService.GetPublicUrl(part.Path + "/" + p.Name))
    .ToList();

    I had to change it to this:

    return _mediaService
    .GetMediaFiles(part.Path)
    .OrderBy(p => p.Name)
    .Select(p => _mediaService.GetPublicUrl(part.Path + "/" + p.Name))
    .ToList();

    to get it to work. All that changed was "physPath" was changed to "part.Path". My tests show this change works for Azure and non-Azure websites.

  • This module is great, exactly what I was after (a simple way to associate images with content item.)

    But, is there problems with it in Orchard 1.4.2? I had it working using 1.4.1 but when using a fresh install of 1.4.2 the thumbnail is no longer showing in the list view in the admin, nor is the "Gallery Image Path" editor with the list of thumbnails in admin edit mode.

  • @Luke: I use it on 1.5 sites without a problem. If you found a bug, please report it on CodePlex.

  • This is a very cool and minimalistic (in a positive meaning) gallery!
    The only thing missing is a thumbnail generation for the pictures.
    This thumbnail generator sounds like a good place for an indipendent module so it can be used in other places. I've noticed, that Orchard itself doesn't shrink the pictures in the "Media" module.
    Is there something built in into Orchard which can already be leveraged or is this something that needs to be written from scratch?

  • @toburger: no, actually I stayed clear of that because it's going to be provided as a core service in Orchard 1.7.

Comments have been disabled for this content.