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 ↓

  • DanP says:
    Hi Chris,

    Thanks that would be much appreciated.

    Dan

  • Paul says:
    Hey Christian I’ve been using your plugin for awhile and have been having some problems lately.

    First off I’m using an outdated version where in my index I have the code. However, when I update to the latest version it breaks my gallery and just displays the text and images… Why is this happening?

    My second problem which you can see on my site right now is even worse… For some reason when I add new post with Stickys it breaks my gallery on page 1 of the index yet works fine on page 2 and other pages of the index…

  • Timelady says:
    Christian,

    great plugin. One problem we are having is that the delay rate is not working on WP 2.7.1, and we are getting images whizzing by with a second or less interval. Any suggestions? We are using custom fields and the simple [smoothgallery] invocation.

  • Michael Zick Doherty says:
    Same problem as timelady, though I am not using shortcode. Also the carousel option breaks the slideshow!!
  • Hi Paul, Timelady and Michael,
    @Paul: I’ll write you an e-mail so we can figure this out.

    @Timelady, @Michael: Do keep in mind that the delay is specified in milliseconds, i.e. if you supply, say, d:5000 in the custom field that will be 5 seconds between each transition. Depending on the browser and the computer’s speed setting the value below 1000 isn’t a good idea either.

    @Michael: please read what I wrote Andrew in this comment, maybe that helps you to figure it out.

  • EN says:
    I’d love to say “awsome” but not yet…for some reason I’m not seeing anything but a site within a site via the iFrame. And then if I do show it, its one long list of pictures.

    I will tell you im using mootools /jquery sliding code within the site but geesh. I’ve been looking at this for about a day now and still I can’t figure out where the problem lies.

  • JG says:
    Promising so far…but I’m having the same problem as Michael and Timelady w/the delay. Tried doubling to 18000 even and no change. Wondering if anyone figured that out yet?
  • Edwin says:
    Strangest thing: on the post-page everything is working fine, but on my homepage (where all recent posts are displayed) it just shows a list of pictures… Any idea?
  • Hi JG and Edwin,
    @JG: Timelady just reinstalled the plugin and everything worked fine. I don’t know what’s causing the problem so far. I’ll write you an e-mail so we can figure this out.

    @Edwin: this is a problem with WordPress I wasn’t able to solve until now. Please use the iFrame feature and everything should work fine.

  • Sergio says:
    i delete the images in the post and solve the problem.
  • Edwin says:
    Great! Works like a charm, thanx for replying so quickly Christian
  • JD says:
    I added NexGen gallery and Smooth Gallery to my Thesis Theme.

    Gallery specific options are:

    [smooth=id: yyy; width:500; height:400; timed:false; arrows:true; carousel:true; links:true; info:true; align:left; frames:false; open:false; text:more pictures;]

    Pictures are enlarged in another window when gallery is clicked. Carousel works fine. But instead of getting the full image in that 500×400 gallery frame, only a portion of the entire image is shown. (My images are quite large, some up to 2288×1712).

    How do I have the original image automatically shrunk to fit inside the 500×400 size frame?

    P.S. Codes scare the heck out of me. I’ve read your wonderful explanation multiple times and watched the videos too, but I just can’t get wrap my head around all the jargon. Short codes, long codes, iframes, etc. It’s way over my head.

    Your kind help is much appreciated.

  • Hi JD,
    I’ve got nothing to do with NextGen nor the SmoothGallery plugin for NextGen. Please have a look at this page and ask your question there.
  • regan says:
    I appear to be having some difficulty accessing albums via flickr and/or picasa – keep receiving this error:

    “Fatal error: Call to undefined function get_picasa_images() in /home2/regandev/public_html/portfolio/wp-content/plugins/smoothgallery/utils.php on line 411″

    and a similar one for flickr (I believe it was line 406?).

    I’m using smoothGallery for another page (“Training”) and it works well, but I’m asking it to reference photos from my WP gallery so…there it is.

    Any ideas what I can do to address this? Thanks!

  • Hi Regan,
    oh, I’m so sorry that I forgot to document that you have to edit the config.php that comes with the plugin.
    I’ve updated the corresponding section.
  • Michael Doherty says:
    how do i use the iframe option (so i may be able to have multiple smoothgallerys on one page) but at the same time use image from URL. When I insert image on the page from URL, the shortcode option doesn’t seem to work
  • Hi Michael,
    that’s not working with the current release but I’ve already implemented it. I’ll publish a new version any time soon…
  • Michael Zick Doherty says:
    Great looking forward to it. I think that fix will really make it a legitimate plugin as well as an important part of wordpress development.

    Thank you for your work.

  • regan says:
    Hi again,

    I’m still having trouble getting flickr or picasa to work with SmoothGallery – I did implement the css changes you noted (thanks!) and a blank space appears where I imagine the iFrame would be, but there is nothing in the space.

    I have found a workaround – I create a blank page, upload the photos that I’d like in one SmoothGallery to that page’s gallery, then reference that page using the id attribute. I have to create a separate page for each “photoset” but…it works.

    Shortcode works for me only if I have the custom field disabled.

    Am I missing something else? Thank you for all of your help!

  • Zeke says:
    So when’s the new release due out? heard there might be a copy of Alice and Wonderland in the mail!
  • I’ve had a hard time answering all the questions – there were thousands of emails lately. All this led to feature requests, suggestions and even more fixes.

    Anyway, looking forward to package a new release this weekend…

  • yosafat says:
    Hi Chris,

    first of all, this type of plugin is that i want for so long. finally i found it.

    i want to know, how to disable open image in new window. since it has conflict with my theme. i use flickr image.

    please visit my site n see the problem when people click the image.

    thank you so much.

  • Hi yosafat,
    just use embedLinks=false along with the shortcode.
    BTW: nice website ;)
  • yosafat says:
    wew…fast response :D
    thank you so much. it works…
    God bless you…
  • Kane says:
    BEAUTIFUL Plugin!!!!!!!! Thanks! It works wonderfully pulling images from flickr.

    I am having one slight issue adding a flickr set breaks the show. Am I using the right code, or have I messed it up?
    [smoothgallery flickrusername=XXXXXXXX@XXX flickrphotoset=Slideshow]

  • Hi Kane,
    first off, thanks a lot for your feedback on the Flickr functionality, it helps me to improve this feature in future releases.
    Currently you can’t use the name of a photo set but have to use the numerical ID. Say, you’ve got a set called Disneyland – grab the ID from the URL and use it in the shortcode; it’s 72157601444005542 in this case.
  • Kane says:
    Thanks! that worked perfectly! I don’t know why I didn’t try using that number instead of the name.

    This plugin is perfect! thank you so much for sharing it!

  • Kane says:
    I just upgraded to 1.15 and it broke the slideshow.

    Fatal error: Call to undefined function get_flickr_images() in /path/to/smoothgallery/utils.php on line 418

    Any Ideas?

  • Hi Kane,
    more likely than not the file config.php was replaced during the upgrade. Please follow these steps and make sure that the configuration won’t be overridden on the next update.
  • Kane says:
    That did it. I can’t believe I didn’t check that before posting. Sorry.

    Thanks again for the great plugin and quick replies!

  • Michael says:
    So adding the carousel, even in the new version still seems to break the show. I added this:

    [smoothgallery iframe=1 flickrusername=59689115@N00 showInfopane=false width=480 height=320 timed=true delay=4000 bordercolor=fff showCarousel=true]

    When I try it without the showCarousel it works fine!

  • Hi Michael,
    I haven’t had the time to update the documentation, sorry. Please open the file config.php under wp-content/plugins/smoothgallery, search for ENABLE_GENERATED_THUMBNAILS and set it to true; currently this defaults to false to prevent unwanted side effects.

Leave a Comment

Hint: consider reading the FAQ before submitting a question.