WordPress SmoothGallery Plugin

This WordPress plugin helps you to embed JonDesign’s SmoothGallery in your blog.

Basically it’s this simple:

  • upload some pictures to a post or page
  • use the shortcode smoothgallery
  • set some options
  • watch your smooth gallery

You can download the plugin here.

Example

Have a look at this example. Kudos to my brother and his friends for taking these awesome pictures; thanks that I may show them here.

Bergpark - Bridge

Another stunning picture.

Bergpark - Bridge

Bergpark - Aqueduct

Wow! That's awesome.

Bergpark - Aqueduct

I’m collecting real world examples where this plugin was used: if you’re interested have a look at the showcase page.

How to

Once you’ve activated the plugin you can start adding galleries to your posts and pages. I’ve split up this How to section into the following use cases.

Getting started

Adding a smooth gallery to a post or a page is easy! Try this:

  • go to the edit screen for a post or a page
  • right below the input field for the title click on Add an Image
  • upload some images and enter a sensible title and description
  • reorder the images however you want them
  • insert [smoothgallery] somewhere in the content
  • add a custom field named smoothgallery with its value set to On
  • hit save and click on View this Post/Page to see the result

If you’d like to customize the gallery check out the available options.

Activating the development version

If you’d like to use the latest version of SmoothGallery just activate it in the file config.php:

  1. add a # at the beginning of line 43 and 44
  2. remove the # from line 45 and 46

The plugin now uses the new version; currently SmoothGallery 2.1beta1 with Mootools 1.2.

iFrame it

Embedding the SmoothGallery inside an iFrame has several advantages:

  1. the JavaScript for SmoothGallery doesn’t interfere with incompatible frameworks like jQuery, PrototypeJS that you’re probably using on your site
  2. you can have more than one gallery on a single page

Just add iframe=1 as an attribute to the shortcode. If you’ve previously used the normal SmoothGallery and put all the options inside the custom field you’ll have to transfer these to the shortcode now. Say, you’ve got h:250 and i:false in your custom field then you would put this into the shortcode [smoothgallery iframe=1 height=250 showInfopane=false].

Note that you don’t need the custom field anymore; just remove it. Furthermore you can’t use the shortcuts, e.g. h for height, use the long version instead, i.e. height instead of just h. Finally you can’t even use : instead of = in the shortcode either.

More than one gallery

All you have to do is adding the shortcode [smoothgallery] several times to your content, with the iFrame option enabled. Have a look at the options on how to customize the appearance of the galleries.

If you don’t want to use iFrames for some reason have a look at this alternative solution.

A gallery in your sidebar or theme

I’ve created a separate page for this issue.

Some people want to do this because they’d like to have the images of the most recent posts inside a gallery; sometimes displayed in the header part of their theme. Read about this here.

Images from Flickr or Picasa

Your images are hosted on Flickr or Picasa and you want to show them inside a SmoothGallery on your blog? No problem, follow these two steps.

  1. Open the file config.php that comes with the plugin in an editor, search for ENABLE_FLICKR and ENABLE_PICASARSS and change the value from false to true for one of them or both. If you’d like to use Flickr make sure to supply your API key (FLICKR_APIKEY) and secret (FLICKR_SECRET) as well.
  2. Use the following attributes along with the shortcode:
    • flickrusername: supply your Flickr username and the most recent photos from your photo stream will be included in the gallery.
    • flickrphotoset: use this if you want to show images from a particular set of photos.
    • picasaurl: navigate to an album on Picasa, grab its RSS feed and supply it with this attribute in the shortcode.

Have a look at the examples to learn more about their usage.

In case you want to resize images on the fly there’s a parameter called imgmax that you can use. This parameter special to Picasa will resize the image to fit in the frame of SmootGallery. Here’s an example:

[smoothgallery iframe=0 width=640 height=480 embedLinks=false
 timed=true delay=6000 bordercolor=fff imgsize=640x480
 picasaurl=https://picasaweb.google.com/[...]/4711?imgmax=640]

Notice the imgmax parameter at the end of the picasaurl.

Using ReMooz to open the images

If you’ve linked to larger images in your SmoothGallery but don’t want them to open in a new window ReMooz comes to the rescue. Make sure to activate the development version first and keep in mind that this won’t really work if you’ve put SmoothGallery inside an iFrame.

Either add r:true to the custom field or add useReMooz=true as an attribute to the shortcode.

Generated thumbnails

If you’d like to use the carousel feature of SmoothGallery you’ll have to either generate thumbnails yourself or use the plugin to do this for you: just set ENABLE_GENERATED_THUMBNAILS in the file config.php to true. Furthermore make sure that the directory cache under smoothgallery/extra is read/writable by the webserver.

By default, the shortcode generates markup that contains a link for each image to its large version. This is great if you’d like to have a pure image gallery. If you’d like to setup a gallery, say, for your featured posts with a teaser image and a link to the corresponding post, you can do this like so:

  • go to Media Library
  • edit an image
  • supply a SmoothGallery link

and save. Once you’ve done that the image in the gallery uses the given URL.

For control freaks

If you’d like to have more control over the exact markup that gets inserted inside your page, maybe you don’t want to use the shortcode but insert everything yourself. I’ve prepared two starting points for you:

  1. under Advanced Options on the edit screen scroll down to SmoothGallery and use the generated HTML markup
  2. generate the markup with this tool

No matter what you’ll use, you’ll end up with some markup that you can start customizing. Check out all the available options for full flexibility.

You also might want to check out the tool box which has got useful wizards to ease the creation of compatible markup.

Options

If you aren’t using iFrames and you don’t annotate your post or page with smoothgallery the CSS and JavaScript will not be loaded and the gallery won’t work. So, add a custom field with the key set to smoothgallery if you’d like to enable the SmoothGallery for a particular post or page. If the value is set to 1 or On the default values for the gallery will be used.

If you want to change the defaults you can use the following options. I’ve split up this section into options that come with SmoothGallery and the ones that I’ve added. It’s meant as a reference for you – so, if you’d like to change something you can look up the options here.

SmoothGallery options

Here are the most common options for SmoothGallery. If you need more: have a look at the top of the file utils.php that comes with this plugin.

Option Short version Default value
showArrows a, arrows true
showCarousel c, carousel false
showInfopane i, info, infoPane true
embedLinks l, links true
timed t false
delay d 9000

I added some more options that aren’t part of SmoothGallery. They help you to customize the dimensions and other CSS related parameters.

Option Short version Default value
height h 345
width w 460
bordercolor b, border 000

Example for the custom field

With the following code you would end up with a timed gallery that is set to 350×400 pixels and has got a white border. This goes into the custom field named smoothgallery:

w=350
h=400
timed=true
b:fff

As you can see, you can use : instead of = too. Mixing the long and short version of the attribute names is okay.

Shortcode

The shortcode [smoothgallery] has got some more attributes. If you’re using the attribute iframe along with the shortcode you can use all the above plus the following attributes. Currently the shortcuts that may go into the custom field, e.g. h for height, aren’t supported here – use the long version instead, i.e. height instead of just h.
Please don’t confuse the following with the options that you can use along with the custom field – the following attributes are solely for the shortcode.

id
By default the shortcode uses the images attached to the current post or page. If you’d like to use the images attached to another post or page you don’t have to upload them again but just specify the id of the specific post/page with this attribute.
iframe
Add this parameter if you’d like to take advantage of a gallery inside an iFrame.
iframebgcolor
Adapt the background color of the iFrame. Just supply the color code without the preceding #.
imgsize
If you upload images with WordPress thumbnails will be created for you. We can try picking up these images instead of the original version with this parameter. Say, you’ve set the Thumbnail size for your images under Settings – Media to 150×150 pixels. If you add the parameter imgsize=150x150 to the shortcode the gallery will display the thumbnails instead of the originals.
flickrusername, flickrphotoset
Either just supply your Flickr username and the most recent photos from your photo stream will be included in the gallery or add the attribute flickrphotoset to show images from a particular set. Hint: when you click on a set in Flickr, in the URL it says /sets/numbers#: that number is the one you should use with flickrphotoset.
picasaurl
Navigate to an album on Picasa, grab its RSS feed, supply it with this attribute in the shortcode and the gallery will use your images from Picasa.
dir
You just want to show some images that are in a directory on your webserver? Open the file config.php, add your directory to the array inside the function getImageDirectory and add the attribute dir to the shortcode pointing to the path in the array, i.e. dir=0 for the first path, dir=1 for the second one and so on.

Examples for the shortcode

On this very page I’m using the following simple shortcode to generate the markup for the SmoothGallery:

[smoothgallery imgsize=400x266]

This will grab the images that I uploaded to this page for the gallery. The attribute imgsize says, that I don’t want to use the images with their original size, but the thumbnails that were generated by WordPress during the upload process.
Alongside this shortcode I put this into the custom field named smoothgallery:

w:400
h:266
l:false
t:true
d:6000

This makes sure that the width and height are set accordingly; that there’re no links to the large versions of the images; that it’s a timed gallery with six seconds between the transitions.

As you can see some options go into the custom field and others go into the shortcode. In case you’re adding the iframe attribute to the shortcode you have to supply all the options that originally went into the custom field in the shortcode; this is due to technical reasons and the way iFrames work.

If I wanted to use an iFrame instead, the above example would become (line break just for readability):

[smoothgallery iframe=1 width=400 height=266 embedLinks=false
               timed=true delay=6000 imgsize=400x266]

Note that you don’t need the custom field anymore; just remove it. Furthermore you can’t use the shortcuts, e.g. h for height, use the long version instead, i.e. height instead of just h. Finally you can’t even use : instead of = in the shortcode either.

The images for the gallery can be imported from virtually anywhere: Flickr, Picasa or a simple folder on your webserver just to name a few. If I wanted to show the images of my photo stream on Flickr I would use this shortcode:

[smoothgallery flickrusername=27834774@N05]

Just showing the photos of a particular set can be done using the flickrphotoset attribute. The same works with albums from Picasa: browse the albums there, copy the corresponding RSS feed and add it to the shortcode with picasaurl.

Confused ?

Are you confused because of all these options, attributes, parameters, shortcuts and shortcodes? Instead of getting angry at all this stuff please just stay relaxed, read the FAQ or add a comment with your problem to this page and I’ll try to come up with a sensible response. If that doesn’t help and you’re still puzzled I may help you out.

Message from Certkiller We offer 642-436 training with braindumps that include custom design templates and other WP themes to help you pass 640-816 exams.

633 comments ↓

  • Hi twincascos,
    I don’t think that it’s a good idea to switch the slideshow script because a lot of people using this plugin want to have a SmoothGallery and I don’t want to disappoint them.
    That being said, Slideshow2 looks really great and it should be pretty easy to package it in a plugin.
    Regarding your problem: replace class="thumb" with class="full".
  • STORMizer says:
    Hi all,

    Has anyone figure out how to make the image opened in a lightbox-sort-of interface? This great plugin (when clicked) will open the full-picture in a new window, what i had in mind is for it to open in a lightbox interface.

    Any enlighment or assistance will be appreciated.

    Christ: you might want to include that feature in the next version ;) –that is if its not already there and i simply miss something.

  • Hi STORMizer,
    if Jonathan Schemoul releases a new version of SmoothGallery that works with Lightbox and the like I’ll add this to the plugin as soon as possible.
  • Ray says:
    hi,
    this plug-in is really nice. I was wondering if there is a way to remove the black border that shows up on the images? Thanks!!
  • Hi Ray,
    first off, thanks for writing the 100th comment ;-)
    I just packaged a new release (1.8.1) that allows you to set the color for the border. The default is black but if you’ve got a white background you can remove it by adding b:FFF to the custom field smoothgallery.
  • Ray says:
    thanks for the help. I just seen the update :)
  • Taeke says:
    Hi Christian,

    thanks for the plugin I have implemented it on some of my sites and it works great. For a client I would like to use his Flickr account as the main source of images. Would that be possible (in a future release?) with this plugin?

    your thoughts on this are appreciated!

  • Hi Taeke,
    the integration with Flickr is a great idea. I’ll figure out the details and include a first draft in the next release.
  • Is there a way to make the center link to a post instead of to the image itself. I would love to have the slideshow on my front page and people could click through it to reach an archive they like…. I hope I am explaining what I am wondering. I feel pretty clueless but I love the plugin! Thanks! Martha
  • Hi Martha,
    yes you can do that: just replace the link to the large image with a link to your archive page. So instead of this:

      <div class="imageElement">
        <h3>Wedding Cakes</h3>
        <p>Have a look at my Wedding Cakes.</p>
        <a href="http://[...]/cake.jpg" title="open image" class="open"></a>
        <img src="http://[...]/cake_thumb.jpg" class="full"
             alt="Wedding Cake" />
      </div>

    you would replace the link in the href inside the a-tag with something like the following:

      <a href="http://marthathecakelady.com/?cat=4" title="open image"
         class="open"></a>

    I hope that helps!

  • Alex D says:
    I’m trying to put this onto the homepage of my games reviews website http://www.nometet.com but was having a little trouble, so, I looked at your videos but the one that explained how to get started was “unavailable” – could you re-upload it?

    Thanks for making the plugin!

    Alex

  • [...] SmoothGallery – mostra uno slideshow di immagini relative ai vari post, con il relativo excerpt per ognuna. [...]
  • [...] Read the original article and the explanation here. [...]
  • Andly says:
    I Chris, I’m having the same trouble of Alex, please re-upload the video, Thanks!

    Andly

  • Jeff says:
    Where is the config.php in WP 2.5?

    You can’t see the gallery and you’re using Prototype or jQuery on your site? Then you’ll have to change the value SMOOTHGALLERY_USE_NAMESPACED to true. You can find it in the file config.php on line 29. If you don’t use one of these frameworks set it to false; that’s the default.

  • Hi
    Alex and Andly: I’ve uploaded the videos here and there.

    Jeff: you can find the file here: wp-content/plugins/smoothgallery/.

  • Justin says:
    Hi Christian

    Thanks for the plugin, still trying to get it to work tho.

    I’m getting a Javascript error in mootools.js on line 3, which is the following:

    Element.Styles[style].push is not a function e("Top")

    The page is not showing up any of the images.

    Hope you can help me out

    Thanks

  • Justin says:
    I’ve figured it out, it was the conflict with script.aculo.us.
  • Joel says:
    Need help – plugin does not work in WP 2.5. Returns this error:
    plugins\smoothgallery\smoothgallery.php on line 94

    And another question – is there a tutor/documentation that would explain how to use this plugin (the vid it seems has gone)

    Is it possible to get somewhere instruction step by step? – things here are a little confused…

  • Hi Joel,
    have a look at this comment: you can download two of the videos from the given locations.
    The step-by-step instructions are on the top of this page. Basically it’s inserting the HTML markup and adding a custom field named smoothgallery to the post/page.
  • I am making a website for my mom, using WP 2.5.1. and the livingos-upsilon-1 theme which incorporates smooth gallery. Uber cool, but here’s my problem.
    http://ukuleleuniverse.com
    The pictures appear and roll fine on the about me page (which I have set as the static start page) and the home, but it hangs up on any other page or post. I have checked the code the best I know how to and it seems right….any advice? Also, one of the original pretty pictures (that came stock with the theme) seems to flash as I navigate around prior to showing my custom ones and/or prior to getting hung up in limbo. Don’t know how to get rid of that or fix this problem….hmmm….What am I missing?
    Vicki
  • Hi Vicki,
    I’m not the author of this theme, it’s Tim Hyde. Although I might help you fixing easy problems, please ask him this specific question.
  • wildgames says:
    Anyone knows if that plugin is compatible with WP 2.6?
  • wildgames says:
    Hi!

    I tried it with WP 2.6 and works fine. :) Bye!

  • julxz says:
    hi,

    thanks for this plugin..
    its really amazing, ive used this plugin to one of my websites..

    just one question, is there a way to increase the length of the description?

  • Hi julxz,
    there’re three things you can do that come to my mind: increase the size of the infopane, reduce the size of the descriptions font or do both.
    You’ll just have to change some CSS and here’s how it works. Open the file jd.gallery.css from the directory css; you can find it in the plugins directory. Then:

    1. locate the stanza .jdGallery .slideInfoZone and change the value height to say 80px. This’ll increase the size of the infopane.
    2. find the stanza .jdGallery .slideInfoZone p and change the font size to say, 50%.

    While the latter isn’t such a good idea, the first option seems to be a nice solution.

  • julxz says:
    thanks christian,

    this would really work.. what i will do is just increase the size of the infopane..

    thanks for this plugin, its really amazing..

  • Jon says:
    Hi Christian, great plug-in… I just can’t get it to work.

    In Firefox, WP2.5, plug-in activates fine, appears to work (generates the html), but refuses to display on the page.

    Not trying to integrate into the theme, just a page.

    The correct calls for header and footer are included and I have no other plug-ins installed. Using a theme called Cutline 3-Column Split. The page source shows the javascript within the footer: You can see the source @ http://bikes2trikes.riverstrucking.com/.

    I just can’t make it work…

  • Hi Jon,
    everything seems fine, but the markup for the gallery is broken because the link to the large image is missing. Please have a look at this comment for a solution.
    Once again, I strongly recommend using Firebug for troubleshooting problems like this.
  • Frank says:
    I run a website and have managed to incorporate your fantastic plugin on the fontpage, currently only on my test page http://test.detvarjofint.net/

    It works like a charm, except one thing. The title is displayed in light grey in Firefox and Opera, but in IE they are in dark grey. See example on http://test.detvarjofint.net/smoothgallery_FFvsIE.jpg or just vist http://test.detvarjofint.net/ with the different browsers.

    I think I might be able to do something with CSS, but I suck at that. Anyone to any tips?

  • Jon says:
    (sheepish grin)
    and THAT’S why i should get more sleep.

    Thanks for the pointers, looks like that was my problem.

    You do great work. Compensation forthcoming!!

  • Frank says:
    Also one more thing. I have implemented carousel, and it seems to be working, except for one thing.

    Jons page say I can use textShowCarousel: ‘My new text’ to change the text, so not to show “Pictures”.

    So I implemented that in my config.php, it’s now like this, but the text don’t change.

    function insertSmoothGallery() {
      return array('width' => 466,
                   'height' => 175,
                   'timed' => 'true',
                   'delay' => '10000',
                   'textShowCarousel' => 'Snarvei',
                   'showCarousel' => 'true');
    }

    That should work, right?

Leave a Comment

Hint: consider reading the FAQ before submitting a question.