Alex Wilson Photography > Blog

jQuery plugin and Zenphoto theme: Silhouette

I’ve been able to work out a number of bugs and quirks with the new gallery code, and I have both the jQuery plugin and Zenphoto theme code available for those who are interested. This is still a work-in-progress, so I make no guarantees that all will work perfectly, so please treat this as a “preview” release.

Edit: Updated to version 0.5, new files below.

Silhouette is a jQuery plugin that takes a list of images and turns it into a horizontal scrolling gallery. I’ve built a Zenphoto theme that uses it. My previous gallery theme was a combination of Galleria with jCarousel used as a controller. This new theme is written from scratch, and I’ve tried to take features and functionality I liked best, and merge both the image view and scroll control into a single interface.

To see them in action, pop on over to any album in my gallery, such as this one. Please note that I have yet to go through my gallery (2000+ images!) and update the horizontal images to the correct size, so they will currently not look quite as clear due to scaling.

First, about the jQuery plugin on its own. Features:

  • Adaptive loading: Full images are loaded dynamically in order to reduce bandwidth use, but are preloaded (if near enough to the current image) so the user isn’t waiting for loads. Thumbnails images are scaled up to the full size while waiting for full images to load.
  • Navigation: Clicking on current image advanced to next image, or images to the left or right can be click to move to that image. Arrow keys can be used as well.
  • Able to direct-link to images — using #num on URL will make it slide to that image number
  • Degrades well, with no Javascript the HTML is a list of thumbs linked to full images
  • Tested, at least somewhat, with FireFox 3.6, Chrome 5.0, Safari 4.0, Opera 10.5, IE 6 and 8.

Code to include and call the plugin:
<script type="text/javascript" src="jquery.silhouette.js"></script>
<script type="text/javascript">
//<![CDATA[
    $(document).ready(function(){
      $("#container").silhouette( {img_padding_right: 10 });
    });
//]]>
</script>

The plugin drives off an unnumbered list, filled with thumbnail images linked to full images.
<div id="container">
  <ul>
    <li><a href="full_image-01.jpg" title="image 1">
      <img src="thumb_image-01.jpg" alt=""/></a></li>
    <li><a href="full_image-02.jpg" title="image 2">
      <img src="thumb_image-02.jpg" alt=""/></a></li>
    <li><a href="full_image-03.jpg" title="image 3">
      <img src="thumb_image-02.jpg" alt=""/></a></li>
  </ul>
</div>

Simple!

There are a number of options that can be passed in:

  • current (default: 0) – The default image to be displayed. Passed-in value will be overridden with #num in URL. First image is 0.
  • range (default: 4) – Number of images ahead and behind the current to pre-load the full image.
  • container_height (default: 600) – The height of the gallery. The full-size images should be this tall.
  • container_edge (default: 25) – Extra pixels to add to left side of container. (Temporary?) work-around since some browsers add horizontal scroll.
  • scroll_speed (default: 400) – Number of milliseconds for scroll animation.
  • scroll_easing (default: ‘swing’) – Easing for scroll animation.
  • fade_speed (default: 400) – Number of milliseconds for fade animation.
  • img_padding_right (default: 0) – Pixels to pad on right side of images.
  • img_opacity (default: 0.25) – Opacity for faded-out images.

Download jQuery plugin: jquery.silhouette-0.4.js
Download jQuery plugin: jquery.silhouette-0.5.js
(fixes images not scrolling correctly to middle)

If you are using the awesome Zenphoto gallery, I’ve put together a theme that matches my own gallery using the Silhouette plugin.

The theme will require some customization, since I don’t have settings set up for it yet. It will work best if your full images are sized so that their height matches your container/gallery height, and you don’t want to have cropped thumbnails.

Download theme: silhouette-theme-0.4
Download theme: silhouette-theme-0.5
(adds support for protected image URLs, menu and Goggle Analytics settings via theme options)

Posted in: Updates

Tags: , , , ,



16 Comments

rssComments RSS transmitTrackBack Identifier URI


[...] More info and download No comments [...]

Pingback by Zenphoto » Third party theme: silhouette on 2010-03-07 6:48 am


Hey Alex!

I really like your gallery.

I’m thinking of using it on my site. Is there any way to add next/previous buttons +descriptions?
btw, your b/w images are amazing!!!!

Thanks!
Harvinder

Comment by Harvinder on 2010-03-19 12:37 am


If you’re not afraid of a little JavaScript, both should be easy to do. The changeImage function (or a modified version of it) can be used for next/previous. The descriptions are stored as the image “alt” text, so that can be grabbed and set as the text of a description div.

I think they’d be pretty useful, so I’ll look at adding them to the next update for the plugin.

Comment by Alex Wilson on 2010-03-19 9:53 am


I tried adding the following for the first image. It works.
« First
I can’t seem to get the “next” to work.
Next

btw, your comment fields are black on black.

I’ll post a link to the gallery when its done

Comment by Harvinder on 2010-03-19 6:39 pm


Hi, your plugin for zenphoto is wonderful, but it doesn’t work
appears this error:
Fatal error: Call to a member function on a non-object in /membri2/wishlagoon/gallery/zp-core/functions.php on line 2012

you can help me ?
thanks

Comment by Alessia cosio on 2010-03-26 9:54 am


Make sure you are using the latest ZenPhoto (currently 1.2.9)

Comment by Alex Wilson on 2010-03-26 11:16 am


I have downloaded it yesterday, is the 1.2.9 version…

Comment by Alessia cosio on 2010-03-27 7:50 am


I have same problem with Alessia, I use ZenPhoto 1.2.9, but your theme still doesn’t work.

Fatal error: Call to a member function getCurrentTheme() on a non-object in D:\xampp\htdocs\dewabayu.com\zp-core\functions.php on line 1923

can you help me, please?

thanks, :-)

Comment by Dewa Bayu on 2010-03-27 1:02 pm


Really wanted to use your excellent them, but I’m having the same problem:
“Fatal error: Call to a member function on a non-object in…”
I’m using the latest version of ZenPhoto (1.2.9)

Comment by PeteJ on 2010-03-28 12:43 am


Odd, I know it’s working on my own installation, obviously — I’ll double-check that all the files in the posted archive match what I’m running.

Comment by Alex Wilson on 2010-03-29 2:32 am


I have same problem, I use ZenPhoto 1.2.9, but your theme still doesn’t work.

Fatal error: Call to a member function getCurrentTheme() on a non-object in D:\xampp\htdocs\dewabayu.com\zp-core\functions.php on line 1923

please help ?

=)

Comment by ebi on 2010-04-07 4:02 pm


Hello,

I downloaded and installed your Zenphoto Silhouette theme but got a strange result.

The photos are horizontally stretched as if they were given a fixed width…

Is there something I must configure?

Thanks in advance for your help.

Comment by Chris on 2010-05-03 7:35 am


Beautiful theme, thank you so much !

It worked out of the box with me (I am using ZenPhoto).

I love it. Trying to modify it to set either height or width of the pics, as I do landscapes or vertical photography – I’ll of course share if I can make something working.

Keep up the good work !

CHeers

Comment by David on 2010-05-03 8:32 pm


Hello,

I found a fix for this problem. Search in template functions and remove parameters and change name o theme to it: getCurrentTheme().

Best regards,
Largo

Comment by Largo on 2010-05-10 5:59 am


I have same problem, I use ZenPhoto 1.2.9, but your theme still doesn’t work.

Fatal error: Call to a member function getCurrentTheme() on a non-object in …\zp-core\functions.php on line 1923

Comment by Thunderf1 on 2010-05-12 1:20 pm


Chris, under the theme options, uncheck “crop photos” that should do it. :)

Comment by Bobby on 2010-06-01 7:13 pm

addLeave a comment