Skip to content

joshhart/radiant-gallery

 
 

Repository files navigation

A Radiant (radiantcms.org) extension by Andrea Franz (gravityblast.com) and maintained by Thomas Cowell (eightsquarestudio.com) that allows to manage galleries of images, photos and all kind of files.

Features

  • Multiple nested galleries

  • Multiple upload

  • Import from ftp

  • Images/Files sorting by drag-n-drop

  • Automatic thumbnail generation for images after upload

  • Preview in lightwindow for images

  • Display Exif data of jpeg files

Installation

After the Radiant installation you must install the attachment_fu plugin:

cd /path/to/radiant

git clone git://github.com/technoweenie/attachment_fu.git vendor/plugins/attachment_fu

Then install the Gallery extension:

git clone git://github.com/hairballopolis/radiant-gallery.git vendor/extensions/gallery
cd vendor/extensions/gallery
git checkout 0.9.1 or the latest stable version in line with the current radiant version - master

Now you can run the install task:

rake RAILS_ENV=production radiant:extensions:gallery:install

Configuration

The installation task creates a file called gallery.yml under /path/to/radiant/config/extensions/gallery/. Inside that file there are some variables you can edit:

  • path_prefix: The galleries folder path.

  • processor: The processor used to create thumbnails (rmagick | image_science | mini_magick).

  • default_thumbnails: a list of thumbnails that will be generated after each upload.

  • max_size: size in kilobytes for the maximum allowed size of image to be processed and added.

  • storage: The type of storage to use (:file_system | :db_file | :s3 | :cloud_files) ], the default is :file_system

  • exif_names: The names of exif values, that will be stored on upload of jpegs

path_prefix: public/galleries processor: rmagick

max_size: 3000 #file max size in kilobytes

storage: file_system # default gallery_based: no default_thumbnails: admin_thumb: 300x300 # do not remove admin_preview: 500x500 # do not remove small: 150x large: 450x exif_names: model date_time_original exposure_time f_number focal_length iso_speed_ratings

storage can be updated by also config/environment.rb

config/environment.rb config.after_initialize do … Radiant::Config = “file_system” end

Source code for exif library can be found at github.com/remvee/exifr and is included in the lib folder. All detected Exif value keys are found in lib/exifr/tiff.rb file.

Documentation

Your first gallery

After the installation you will be able to see the ‘Galleries’ tab in the Radiant administration panel. Click on it and start creating galleries and uploading images. Now create a new page, choose one of the layouts created during the gallery extension installation, and set ‘Gallery’ as page type. Publish the new page and go to its url.

Displaying images from a specific gallery

<r:gallery id="GALLERY_ID">
  <ul>
    <r:gallery:items:each by="position" sort="asc">
      <li><r:gallery:item:path /></li>
    </r:gallery:items:each>
  </ul>
</r:gallery>

Displaying all galleries

<ul>
  <r:galleries:each level="all|top|bottom|current">
    <li><r:gallery:name /></li>
  </r:galleries:each>
</ul>

The value of the level attribute could be:

  • all (default): displays all galleries

  • top: displays galleries without a parent

  • bottom: displays galleries without children

  • current: displays children of the current gallery. If the current gallery is not set, it displays all the top galleries.

Displaying all images

<ul>
  <r:gallery:items:each by="created_at" sort="desc" scope="all">
    <li><r:gallery:item:thumb width="100" height="100" prefix="small" geometry="c50x50"/></li>
  </r:gallery:items:each>
</ul>

The value of the scope attribute could be:

  • gallery (default): displays images of the current gallery

  • all: displays all uploaded images

The current Gallery

Create a gallery tree like the following:

- Languages
     | - Ruby
     | - Python
     | - Java

Now create a Gallery page (with gallery as page type) called gallery. Go to its url (localhost:3000/gallery). In that page the current gallery is not set, but if you go to ‘/gallery/languages’, the current gallery is Languages, under ‘/gallery/languages/ruby’ the current gallery is Ruby and so on.

Otherwise you can set the current gallery using the gallery tag:

<r:gallery id="GALLERY_ID">
  <r:galleries:each level="current">
    <!-- loop through the current gallery children -->
  </r:galleries>
  <r:gallery:items>
    <!-- loop through the current gallery images -->
  </r:gallery:items>
<r:gallery>

Thumbnails generation

Thumbnails are generated on the fly with the gallery:item:thumb tag. Inside a page you can write:

<r:gallery id="GALLERY_ID">
  <r:gallery:item:thumb width="200" height="100" prefix="small" position="first" geometry="c50x50"/>
</r:gallery>

The first time you will open that page, the system will generate a thumbnail for the first image of the gallery with id GALLERY_ID. The signature of that thumbnail will be: ‘small_200x100’. The next time the system will not generate the thumbnail if that image already has a thumbnail with that signature.

If you want to generate that thumbnail just after the upload of the image, add that signature inside the gallery.yml configuration file:

default_thumbnails:
  admin_thumb: 300x300   # do not remove
  admin_preview: 500x500 # do not remove
  small: 200x100 # this is the signature you use in the page.
  square: c90x90 # specific sized images with a center crop

Displaying exif data of jpeg files

If Your jpeg’s contain exif data, the data will be stored on upload. An example usage in a list:

<r:gallery:item:infos:each>

<li><r:gallery:item:info:name />: <r:gallery:item:info:value /> </li> </r:gallery:item:infos:each>

Or, to display a specific name/value pair (here the camera model):

<r:gallery:item:info:name name="model" />

<r:gallery:item:info:value name=“model” />

Note, that only name/value pairs can be displayed, which are defined in the gallery configuration file (see above). For example, if You want to display the flash status while taking Your picture, add the ‘flash’ name to Your config file under exif_names. Possible values of exif_names for Your camera can be found in the Internet.

Contributors

Thomas Cowell – hairballopolis – Maintainer Andrea Franz – pilu – Author Benny Degezelle – jomz Edmund Haselwanter – ehaselwanter Philipp Ringli – cmyk Levi Cole – levicole Nikos Dimitrakopoulos – nikosd Chris Moore – cdmwebs Will Prater – wprater Ivan Yatskevich – yatskevich Adam Salter - adamsalter wdso mariozig dip00dip kalebwalton Horst Rischbode - horibo

Credits

Icons by www.famfamfam.com/

About

Photo Gallery Management System based on Radiant CMS (Ruby on Rails).

Resources

License

Stars

Watchers

Forks

Packages

No packages published