Easy 2 Gallery

This is a user-contributed Extra. If you find issues or would like more info or help, please contact the author.

Introduction

The original author is Cx2.

The maintainer of version 1.3.5 (which uses ID number as the file system) is Temus.

The developer of version 1.4.x (which keeps the names in the file system) is goldsky.

You should go to settings in e2g module and set custom options before you start working with gallery.

  • All gallery maintenance is done through module.
  • CSS styling is done in assets/modules/easy2/templates/style.css
  • When you call your snippet first time it generates thumbnails (same when you clear cache)
  • Image viewing and watermarking is done by show.easy2gallery.php
  • Comments viewing and adding is done by comments.easy2gallery.php
  • Comments save in UTF-8

The most updated HELP is on the Module's Help tab.

Snippet call parameters description

Image & Directory ID

These IDs are generated by Module.

&gid - gallery id from which snippet starts it work. default is 1 - root

&fid - image id for single image output (new)

&rgid - gallery id for random thumbnail output (new)

Tag

This tag can be given inside the Module

&tag (1.4.0) - image's/folder's tag (this parameter will ignore the &gid parameter, but can accompanied by &showonly). Options: word/string.

Wild parameters

&where_dir - additional clause(s) into the directory's query

&where_file - additional clause(s) into the image's query

Usage:

  • [field][,comma][operator][,comma][value]
  • They can have multiple clauses by using 'AND' and/or 'OR'
  • The Operator have to be a string, as following:
    **"NULL safe equal" => '<=>'
    **"equal" => '='
    **"greater equal" => '>='
    **"greater" => '>'
    **"left shift" => '<<'
    **"less equal" => '<='
    **"left shift" => '<<'
    **"less" => '<'
    **"not equal" => '!='
    **"right shift" => '>>'
  • Example:
    [!easy2? &gid=`2` &where_file=`id, less, 50 AND size, less, '15000' OR size, greater, '90000' OR name,equal,'ANDROMEDA' OR name, equal, 'BORG'`!]

&showonly (1.4.0) - images | folders, to show only those spesific type

&show_group - slideshow group name (new)

Thumbnails parameters

&w - thumbnail width, px.

&h - thumbnail height, px.

&h=`100` &w=`auto` => fixed height
&h=`auto` &w=`100` => fixed width

&thq - Level of jpeg-compression. 0 to 100%. (100 - max)

&resize_type (1.4.0) - type of thumbnail resizing: 'inner' (cropped) | 'resize' (autofit) | 'shrink' (shrink)

&thbg_red (1.4.0) - thumbnail background color: RED in RGB

&thbg_green (1.4.0) - thumbnail background color: GREEN in RGB

&thbg_blue (1.4.0) - thumbnail background color: BLUE in RGB

&img_src (1.4.0) - the image source for pop-up iframe: `original` | `generated` (using show.easy2gallery.php file to create the WATERMARK, ''default'').

NOTE:
Remember if you want to apply changes to added images you should clean cache. _thumbnails folder is in root of gallery.

&use_redirect_link (1.4.0) - redirect page when the thumbnail is clicked: 1 | 0

Display parameters

&gal_desc - 0 | 1 - Turn on the gallery description

&gal_desc_continuous - 0 | 1 - Gallery description continues through gallery pagination

&name_len - Max length of thumbnail name

&cat_name_len - Max length of folder name

&colls - Quantity of thumbnails per row

&limit - Quantity of thumbnails per page.

&orderby - Field by which thumbs will be sorted out: date_added, last_modified, comments, filename, name, random.

&gpn - start page number.

&order - Sort ASCENDING or DESCENDING, ASC | DESC correspondingly.

&cat_orderby - Field by which folders will be sorted out: cat_id, cat_name, random. (new)

&cat_order - Sort folders ASCENDING or DESCENDING, ASC | DESC correspondingl (new)

&cat_thumb_orderby (1.4.0) - file's database field which the folder's thumbnail will be sorted out.

&cat_thumb_order (1.4.0) - Sort folders ASCENDING or DESCENDING, ASC / DESC correspondingly

Landing Page (1.4.0)

&landingpage - set the slideshow's/thumbnail's landing page.

  • for the slideshow: if there is an 'open image' pop up, but there are no &landingpage is set up, then the image will be opened directly inside the page, replacing the slideshow box.
  • for the thumbnail, it will open the javascript iframe pop up.
  • At the landing page, the snippet should be called again with its own docID:
    [!easy2? &landingpage=`__own_ID__`!]
  • options: document ID.

&lp_img_src - the image source for landingpage: `original` | `generated` (using thumb creator, default).
If it's `generated`, the watermark below will be applied like the thumbnail:

The Watermark

  • &lp_w - landingpage width box, default: will be retrieved from the original size
  • &lp_h - landingpage height box, default: will be retrieved from the original size
  • &lp_thq - default: thumbnail config's setting
  • &lp_resize_type - default: `inner`
  • &lp_red=`255`
  • &lp_green=`255`
  • &lp_blue=`255`

Comments parameters

&ecm - comments on/off, 1 | 0 correspondingly.

&ecl - Amount of comments per page.

Breadcrumbs parameters

&crumbs - 0 | 1 (on or off)

&crumbs_use (1.4.0) - foldername | alias

&crumbs_separator - Separator. default is '/' (new)

&crumbs_showAsLinks - If you want breadcrumbs to be text and not links, set to 0. default is 1 (new)

&crumbs_showHome - This toggles the root crumb to be added to the beginning of the trail. default is 0 (new)

&crumbs_showCurrent - Include the current page at the end of the trail. default is 1 (new)

&crumbs_showPrevious (1.4.0) - Enabling the previous crumb path from the original &gid call. default is 0

Prev/Up/Next navigation

&nav_prevUpNext - 0 | 1 (on or off)

&nav_prevUpNextTitle - cat_name | cat_alias

&nav_prevSymbol - «

&nav_upSymbol - ^^

&nav_nextSymbol - »

Pagination (1.4.0)

Some people just don't like to use pagination, so use this to turn it off:

&pagination - 0 | 1

Templates parameters

&glib - javascript library
Default: highslide

&css - CSS style
chunk name or path to file
Default: assets/modules/easy2/templates/style.css

&tpl - gallery template
chunk name or path to file
Default: assets/modules/easy2/templates/gallery.htm

&gal_desc (1.4.0) - 0 | 1 , the Gallery's information (title & description) above the gallery/directory template.

&dir_tpl - folder template
chunk name or path to file.
Default: assets/modules/easy2/templates/directory.htm

&thumb_tpl - thumbnail template.
chunk name or path to file.
Default: assets/modules/easy2/templates/thumbnail.htm

&rand_tpl - random pic template
chunk name or path to file.
Default: assets/modules/easy2/templates/random_thumbnail.htm

&page_tpl - landing page template (1.4.0)
chunk name or path to file.
Default: assets/modules/easy2/templates/page.htm

&comments_tpl - comments template.
chunk name or path to file, relative to file comments.easy2gallery.php.
Default: assets/modules/easy2/templates/comments.htm

&comments_row_tpl - comments row template.
chunk name or path to file, relative to file comments.easy2gallery.php
Default: assets/modules/easy2/templates/comments_row.htm

CSS / JS parameters

&notables - (deprecated) use <div> instead <table> (new) (for 1.4.0, use grid below)

&grid (1.4.0) - options of thumbnail's grid arrangement, 'css' or 'table'

&css - path to the customized CSS file

&page_tpl_css - Path to landing page CSS file

&js - path to the customized javascript file

&grid_class - CSS classname for the gallery grid

&crumbs_classCurrent - (deprecated) CSS classname for the current crumb

&back_class - (deprecated) CSS classname for the back button

&pagenum_class - (deprecated) CSS classname for the pagination

Slideshow parameters (1.4.0)

If the slideshow requires thumbnails navigation, the thumbnail's parameters apply to them.

Queries

&gid/&fid - the initial image selection parameter.

&ss_orderby - order by fields, or 'random'

&ss_order - ASC / DESC

Displays

&slideshow - slideshow type.

&ss_config - custom configuration/options for each of slideshow types.
The implementation is up to the developer to us it inside the slideshow's index file.

&ss_indexfile
You can create that file elsewhere, and use this parameter to go to that file instead.

&ss_img_src - original | generated. Generated images come from the file generated images, which will apply the watermark.

&ss_w - slideshow box's width.
Default: 400

&ss_h - slideshow box's height.
Default: 300

*&ss_thq - Level of jpeg-compression. 0 to 100%. (100 - max)

&ss_bg - slideshow box's background color.
Default: white

&ss_allowedratio - an allowance ratio of width/height to help distinguishing too tall/wide images while the &ss_w and &ss_h are limited.
the format is 'minfloatnumber-maxfloatnumber', eg: '1.0-2.0'
to disable this restriction, set &ss_allowedratio=`none`
Default: ( 0.75 * &ss_w / &ss_h ) - ( 1.25 * &ss_w / &ss_h )

&ss_limit - to set how many images the slide show should retrieve from the gallery ID.
More images mean longer page loading!
Options : int | 'none'
Default : (int)6

&ss_css - set the slideshow's CSS path.

&ss_js - set the slideshow's JS path.

&landingpage - set the slideshow's landing page.
options: document ID.

Custom $_GET parameters (1.4.0)

$customgetparams

This parameter is used to joined your custom snippet's $_GET parameter with Easy 2 Gallery's pagination numbering.
This parameter is NOT called within the document page, but should be called from custom snippet parameter.

The usage:

$select = 'SELECT * FROM `your_table` WHERE id='.$param1;
$query = mysql_query($select);
$row = mysql_fetch_array($query);

$easy2pictures = $modx->runSnippet("easy2",array(
"gid"=>$row["yourGalleryIdFieldInsideAnotherTable"]
,"customgetparams"=>'&param1=' . $_GET['param1'] . '&param2=' . $_GET['param2']
));

echo $easy2pictures;

The pagination hyperlink will be like:

http://your-website/index.php?id=4&param1=string&param2=string&gid=2&gpn=1

Placeholders description

[easy2:permalink] - permalink to the gallery wrapper
[easy2:title] - current folder's name/alias
[easy2:cat_description] - current folder's description
[easy2:back] - link back to parent
[easy2:crumbs] - folder's breadcrumbs
[easy2:content] - content
[easy2:pages] - pagination

Folders

[easy2:galleryplugin] - plugin layer
[easy2:link] - auto recognition of FURL/URL image thumb's link
[easy2:permalink] - folder's permalink
[easy2:title] - folder's name/alias
[easy2:cat_summary] - folder's short shummary
[easy2:w] - thumbnail's width
[easy2:h] - thumbnail's height
[easy2:cat_tag] - folder's tag
[easy2:cat_id] - folder's id
[easy2:parent_id] - parent folder id
[easy2:cat_level] - level
[easy2:count] - number of files (new)

and all thumbnail placeholders

Thumbnails

[easy2:thumbplugin] - plugin layer
[easy2:link] - auto recognition of FURL/URL path to thumbnail
[easy2:src] - path to thumbnail
[easy2:w] - thumb's width
[easy2:h] - thumb's height
[easy2:id] - id of image
[easy2:name] - image name (if > name_len, that lenght = name_len-2)
[easy2:title] - name/alias
[easy2:summary] - file's short summary
[easy2:description] - image description
[easy2:filename] - image filename
[easy2:size] - size of file (bytes)
[easy2:comments] - comments total for image
[easy2:date_added] - date added
[easy2:last_modified] - last modified date
[easy2:dir_id] - folder id
[easy2:com] - comment count's CSS class

Page (1.4.0)

for landing page

[easy2:src] - path to thumbnail
[easy2:name] - image name (if > name_len, that lenght = name_len-2)
[easy2:title] - title (full name)
[easy2:description] - image description

Comments (row)

[easy2:id] - comment id
[easy2:file_id] - file id
[easy2:author] - author's name
[easy2:email] - author's email
[easy2:name_w_mail] - if email is set "<a href="mailto:[easy2:email]">[easy2:author]</a>", else "[easy2:author]"
[easy2:comment] - comment
[easy2:date_added] - comment date
[easy2:last_modified] - comment last modified date

Comments (page)

[easy2:title] - pagetitle (from langs/*.comments.php)
[easy2:body] - comments
[easy2:pages] - pagination links
+ language specific settings langs/*.comments.php

Additional features

Random thumbnail output

You should use limit = `1` and random order (orderby=`random`)
In this case random_tpl is used.
WARNING: you need to modify rand_tpl and set there url of your gallery page.

e.g.
you have gallery.html (page where main gallery resides) and want to put random pic on your main page or anywhere else.

you put [!easy2? orderby=`random` & limit=`1`!] anywhere you want and modify random_tpl from

<a href="#">
<img src="[+easy2:src+]" alt="[+easy2:title+]" title="[+easy2:title+]" width="[+easy2:w+]" height="[+easy2:h+]">
</a>
[+easy2:name+]

to

<a href="/gallery.html">
<img src="[+easy2:src+]" alt="[+easy2:title+]" title="[+easy2:title+]" width="[+easy2:w+]" height="[+easy2:h+]">
</a>
[+easy2:name+]

You can use rgid parameter for display random pic from custom folder. (new)

Javascript libraries used

Highslide JS
Highslide Docs
please consult their site for legal notice

Plugin

Basic Plugin Parameter

&plugin=`thumb: pluginName1`

Originally, plugins only make a new layer above the thumbnail, but in the displaying process, each of plugins gets all thumbnail's informations from the database by its ID:

  • All IDs of the files are identified by fid_[file_id]
  • All IDs of the directories are identified by gid_[gallery_id]
  • ID for the landingpage is identified by fid_[file_id]

The plugins target the specified objects:

  • thumb (for image thumbnail),
  • gallery (for directory thumbnail),
  • and landingpage (for the image in the landing page).

Advanced Plugin Parameter

&plugin=`thumb: pluginName1#prerender, pluginName2 | gallery: pluginName3, pluginName4@custom/index/file.php | landingpage: pluginName5`
  • If the snippet calls more than one target, the pipe symbol ( | ) is used as delimiter of each of target.
  • The target call is followed by plugin's name after a colon, which are separated by comma if there are more than one plugin applied.
  • The plugin's name is followed by a path to a customized index file after an @ (ampersand) sign, if there is any.
  • The # (hash) symbol is to targeting the 'prerender' or 'render' on event process.

Suggest an edit to this page.