Jump to content


EtoGalThumb 1.2 snippet features and usage


2 replies to this topic

#1 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 18 September 2006 - 02:04 PM

Snippet name: EtoGalThumb
Author: mikef
Version: 1.2 (prelim)
This document last updated 18th September 2006

&#91
Prerequisites:[/u]]
  • Minimum Etomite version: 0.6.1
  • Etogal: A copy of Etogal version 1.0 or later is also required, as this snippet uses the etogal database and image store, and has no management capabilities of its own.
This snippet was created to make it easier to produce customised displays for the EtoGal gallery snippet. It offers greater flexibility in selection of which images to display, in how to order them, and makes it simpler to provide fully customised interfaces without requiring a large number of parameters to be passed in the snippet call. It also allows images to be displayed on a page other than the gallery page.

&#91
Features:[/u]]
  • display EtoGal images or galleries on different page from the gallery id
  • select specific images to display by id or subject
  • select specific galleries to display by gallery page id
  • limit the number of images to display
  • flexible image sorting (including random)
  • (relatively) easy generation of your own display styles (needs HTML knowledge rather than PHP)
  • add section breaks based on number of images or gallery an image belongs to
as examples, I've used this snippet to display
  • a single random image (out of three relevant images) in a news article
  • three random images to act as a separator half way down a page
  • thumbnails of all the images in a gallery, with their descriptions, with a link to the gallery page
  • a random choice of four images from a gallery with the gallery's long title and description, all linking to a custom gallery page
I'm sure you'll find other uses!
There is a demo for an earlier version of this snippet at http://www.lowermosswood.org.uk/72.html which shows the displays created by the in-built styles, and how some parameter changes affect the image selection.
Another example of its use can be found at Efikim Galleries, where a separate call of the snippet is made for each of the galleries. (These use a style similar to the second example near the bottom of this post, though the URL generation for the image links is a little more complex.)

&#91
Installation instructions:[/u]]
  • Download the latest Etogalthumb.php file from the Etogal download area and add it to your installation as a snippet (copy the contents into new snippet).
  • That's it!

&#91
Options you can pass to the EtoGalThumb Snippet:[/u]]
  • only,not - page id where thumbnails should/should not be shown (default is show on any page - these are useful for pages that are shown elsewhere in condensed form (eg news items))
  • link - page id parameter to be used in links (%%link%% parameter)
  • gal - gallery from which images are to be shown (optional, can be a comma separated list)
  • img - id of image to be shown (optional, can be a comma separated list)
  • subject - (new) 'subject' of images to be shown (text match in image title or description)
    - if none of gal, img or subject are defined, all images are used (subject to and exclude specificatio)
    - only one of gal, img or subject should be specified, if two or three are used, the priority order is gal, img, sunbject
  • exclude - id list of images to exclude when selecting by gallery
  • addback - increase total images count by this value
  • count - number of images to use (defaults to 1, if you want all, specify 9999)
  • order_by - maye be set to 'id','gal_id','title','filename','descr','date' and orders by that entry in the EtoGal table
    - if no order is specified, then the order in which results are returned is random (the list returned from the database is deliberately shuffled)
    - 'random' is NOT a valid value
    - ordering using two valid fields separated by a comma should work, but is untested
  • order_direction - "ASC" (default) or "DESC"
  • style - style to be used (required; behaviour if not provided is undefined)
    - valid values depend on the styles defined in the snippet, and may be either numeric or text
  • fullsize - set this to 1 to use fullsize images instead of thumbnails (other values undefined)
    - default is not set (means use thumbnails)
  • resize - desired pixel count on longest side - adjusts the width and height returned in the %%size%% string to give the desired size
  • breakat - insert a section break after each 'breakat' images
  • gallerybreak - inserts a section break whenever the gallery that the next image belongs to changes
This snippet uses a number of replaceable parameters that are inserted into predefined blocks of HTML code. This has the advantage that the HTML code is is in readable clocks, rather than built up piecemeal throughout the snippet PHP code. As a result, it is both easier to change the presentation aspects and easier to maintain the code.
HTML presentation blocks are created at the head of the code in 'style' blocks, with each style having three blocks - header, image and tail.
The header and tail style blocks use only a limited number of parameters, related to the page id passed as the link parameter. As implied by the names, the header block is output before the block of images, and the tail block is output after the images.
The image style block has access to all the parameters used in the head and tail styles, plus additional parameters related to the current image and the gallery it is in. It is output once for each image selected.
All of these style blocks are optional.

&#91
Replaceable strings for use in styles:[/u]]
strings available for the 'head' and 'tail' style strings
  • %%alias%% - the alias for the page passed as the link page
  • %%link%% - the link page id
  • %%ptitle%% - the longtitle for the link page
  • %%pdesc%% - the description for the link page
  • %%total%% - the total number of images selected
  • %%baseurl%% - (the url of the page specified in the link parameter (FURL if enabled)
  • %%sep%% - the separator string for the first parameter to add to a page URL (varies depending on the baseurl format)
strings available for the 'image' style string
as above plus
  • %%id%% - the image id
  • %%size%% - the pixel dimensions for the image file (width and height) as a quoted string as required in an <img> element
  • %%file%% - filename for the image (full path) - this will be for the thumbnail image unless fullsize is specified, when it will be for the full sized image
  • %%fsfile%% - (new) filename for the full size image (full path) - tjis is useful where you want to use the thumbnail for display, but need the path to the fullsize image for other purposes (eg when using thickbox)
  • %%title%% - title for the image (from the etogal database table)
  • %%desc%% - description for the image (from the etogal database table)
  • %%sdesc%% - truncated description (or title if no description present)
  • %%gal%% - the gallery in which the image exists
  • %%gtitle%% - the longtitle for the gallery page
  • %%gdesc%% - the description for the gallery page
  • %%galias%% - the alias for the gallery page
  • %%gurl%% - the URL for the gallery page
These parameters contain everything I thought useful for building the thumbnail display and generating links (and a few later requests for things I hadn't thought of!)
To use, design the HTML you need for your display, and then put the above %%xxxx%% string in the HTML code where you want the associated data to appear, as in the examples below. Then put the resulting HTML into the styles at the head of the snippet.

&#91
Example styles[/u]]
First, a very simple display that just displays the selected image(s) with no links. In this example the header and tail blocks aren't used.
$styleStrings[0]['header']=0;
$styleStrings[0]['tail']=0;
$styleStrings[0]['image']=<<<IMG
<img src='%%file%%' title='%%title%%' alt='%%sdesc%%' class='EGTimage' %%size%%/>
IMG;

and a much more complex style that displays a selection of images from a gallery, and links to it (this assumes use of the link parameter to define the target web page)
$styleStrings[2]['header']="
<fieldset style='background-color: white'>
  <h2 style='top:-18px; left:12px; width:16em; '>
	<a href='[~%%link%%~]' style='color:white; background:silver;' > %%ptitle%% </a>
  </h2>
  %%pdesc%%<br />
  <div style='height:140px;'>
";

$styleStrings[2]['image']=<<<IMG
  <span style='float: left; margin: 10px;'>
	<a href='[~%%link%%~]'>
	  <img src='%%file%%' title='%%title%%' alt='%%sdesc%%' %%size%%/>
	</a><br />
	%%title%%
  </span>
IMG;

$styleStrings[2]['tail']="
  </div>
  <div style='clear: both;'>
	<div style='float: right;'>
	   <a href='[~%%link%%~]'>... visit the %%ptitle%% gallery (%%total%% images)</a>
	</div>
  </div>
</fieldset>
";


#2 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 12 March 2010 - 06:16 PM

OK so can someone help me here? I have been spinning my wheels trying to find all the necessary files and documentation for Etogal with various discussion and other documentation scattered hither and yon, and have found people saying that the Authenticate_visitor snippet is not good on Eto versions other than 0.6?

So what should be used to allow end-user to log in and upload files to the gallery, once set up?

Am so confused and this is really kind of an unorganized mess! I need to set up a gallery, make it output thumbs, and use the Thickbox/lightbox style display.

I have downloaded the following files, found at the Etogal thread:

- Etogal11beta3b.php
- EtoGalGallery1beta3.php
- EtoGalThumb12preliminary.php

But with the last file, the most-current posted version to download gave an error when I clicked on the attachment saying it's not found. So I downloaded the earlier-posted version.

#3 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 12 March 2010 - 07:56 PM

I got this working, the only thing I need to do is get the Thickbox js files to allow for a Lightbox-style presentation.

Gallery under development, at this page





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users