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

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.

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.
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.

550 comments ↓

  • Michael says:
    The carousel works but the thumbs don’t appear. Instead of generating thumbnails it’d be nice if, when using flickr images it just uses the already generated flickr thumbs (image + “_t”). One last thing, when you click the image link it opens in the iframe rather than a new window. Also it should be a link to flickr page rather than the image iteself!

    Thanks for all your hard work!

  • Matt says:
    I’m trying to set default values in the util.php file and nothing is changing? I’m trying to set the following:
    showCarousel = “true” makes the slide show disappear.
    showInfopane = “false” still shows up?
    embedLinks = “false” images are still linked?

    Could this happen if I have the gallery setup wrong on the page? I have added [smoothgallery] into my page. And I also have settings in the custom field smoothgallery
    On
    w=450
    h=450
    b:404040

    I have tried changing the carousel and infopane settings in the custom field values as well and the same things are occuring.

    here is the link to the gallery I’m referring to:
    http://fatgripband.com/?page_id=248

    Any advice would be greatly appreciated.

    Thanks,

    Matt

  • Hi Christian, just saw the update, I was wondering if you’ve been able to uncover the “links” issue that isn’t working.
    Thank you very much!
  • Hi Michael, Matt and David,
    @Michael: I’ll fix those issues as soon as I can.
    @Matt: I’ll write you an email so we can figure this out.
    @David: does this help?
  • Thanks Christian, that does help…. except, my theme opens the link within the box that the image was in. I’d like it to open in a new window. Is this something tat could be adjusted somewhere? It is great to see this working now!
  • Hi David,
    I’ll try to fix this in the next version of the plugin. Will be out next week or so.
  • Marc says:
    Hi, I think the smoothgallery is just the right plugin for my purpose. however, on my local installation I get the following message from my browser after refreshing.

    Fatal error: Call to undefined function insertsmoothgallery() in C:\xampp\htdocs\wordpress\wp-content\plugins\smoothgallery\smoothgallery.php on line 110

    I am not a programmer. Any help is much appreciated. thanks to all.

  • Hi Marc,
    did you make sure to unzip the whole content of the plugin – there should be a file called config.php under in the plugin’s directory.
  • Tony says:
    Unfortunately this doesn’t seem to work with Lightbox2 right now… even with iFrames on. Any ideas?
  • Hi Tony,
    since Lightbox2 uses uses PrototypeJS – which is incompatible with SmoothGallery – this won’t work. Have you had a look at ReMooz? This might be a good alternative.
  • Peter says:
    Hi Christian,

    I find the gallery looking very very cool! and it’s just what i’m looking for!

    But unfortunately i cant get it working. I did take the ‘Getting started’ steps, but i dont get anything like your beautiful smooth gallery :(

    It looks like it just repeats the placed images. I hope you can tell me what i might be doing wrong, check my result here.

    (You can also see there, that the repeated images dont get the maximum size which is set in the general options.)

    Please help me out, its the best gallery i’ve seen so far!

    Thanks in advance,

    Peter

  • Hi Christian,
    I kinda figured out the issue I emailed you on. I had one little thing I can’t seem to isolate. (
    http://www.fbcwaynesboro.org/home) There is a border that shows up on the gallery…. using firebug, it points to this:

    #myGallery, #myGallerySet, #flickrGallery
    {
    width: 612px;
    height: 396px;
    z-index:5;
    border: 1px solid #000;
    }

    Where would I find this code?
    thanks! David

  • Hi David,
    you can find that in the plugins directory under smoothgallery/css in both files starting with jd.gallery – it’s right at the top of both files.
  • Jonny says:
    Having an issue, plugin works great on WP2.7, but my dropdowns went missing, so when I tried iframe I got this error in place of my slideshow, which I think means its conflicting with another plugin. Any ideas?

    Warning: in_array() [function.in-array]: Wrong datatype for second argument in ……qtranslate/qtranslate_utils.php on line 76

  • Hi Jonny,
    I already tested the plugin with qTranslate – because I wanted to use it on my own website – but the iFrame didn’t work. Since I haven’t had a detailed look at the problem I can’t tell how qTranslate or the SmoothGallery plugin might fix this. Sorry.
  • Joseph Pratama says:
    Hi Christian,
    Great plugins.
    Already tested with my website, and works great.

    Thanks

  • Mike Brisk says:
    I can’t seem to get the thumbnails to show up in the picture slider. here is the page http://web.briskstudios.com/ and click pictures on the slider.
  • Hi Mike,
    since you doesn’t seem to use this plugin please ask the author of the plugin that you’re using on your site.
  • Marc says:
    seems like images are cropped to the set width and height. Is there an option so they are resized/scaled to a specified size?
  • Hi Marc,
    although this may be a feature in a future release this isn’t implemented yet. You’ll have to either upload the images in the right size or – even better – use WordPress to scale the images for you. You can adjust the size for the images under Settings – Media. If you’d like to use another variant of an image use imgsize to select the right image.
  • maurizio says:
    Hi Christian

    I’d need your help with my site, but I’m having trouble in finding your email address here on the site.
    Can you please help with it? :)

  • Mauricio says:
    Hi Christian:

    Great work! I would like to know if it possible to get picasa pics with a PHP4 installation? Why is the reason to get the functionality only with PHP5?

    Thanks in advance.

  • Hi Mauricio,
    the plugin uses an API that’s only available in PHP5; namely SimpleXML. Although it’s possible to make this feature compatible with PHP4 – using the old API – I haven’t invested any time in this because I think people should upgrade their PHP installations anyway.
    If you just can’t upgrade to the latest PHP version for whatever reason I’d be willing to code a special solution for your site.
  • Mauricio says:
    Christian:

    Thanks for your response. I expect to show some rotating images coming from a picasaweb album, but I’m hosted on Yahoo hosting, that only support PHP4 and WP 2.6. Certainly I would prefer to use PHP5 but I have no option at this moment.

    I’m trying with something like that:

    [smoothgallery iframe=1 id=385 imgsize=600x400 showArrows=false delay=6000 timed=true height=400 width=600 showInfopane=false showCarousel=true embedLinks=false bordercolor='fff' showCarouselLabel=false picasaurl='replace_picasaurl']

    Regards from Chile.

  • QuestionMark says:
    Hi Christian, thanks for your work. Could you give any hint on how could I make this plugin work with custom field images instead of post id? thanks in advance. best regards.
  • Hi QuestionMark,
    you’d have to change the plugin a little bit to support this; in case you know PHP have a look at the file utils.php and change the function starting on line 413 returning an array with the format that’s documented on line 165.
    If you don’t want it to make that fancy you should hardcode it into your theme, i.e. collect the custom fields and generate the markup for SmoothGallery. The configuration of the gallery can be done using the plugin and its insertSmoothGallery function (config.php).
  • Michael says:
    Mauricio you should ask Yahoo to upgrade their servers or move to a better host. I recommend http://mediatemple.net/ but there are other cheaper alternatives as well.
  • Vangelis says:
    Hi Matt and Christian,

    I am having exactly the same problem. How did you get to solve it?

  • Hi Michael and Vangelis,
    @Michael: sure, that would be the best thing to do. Thanks for the hint to Media Temple.

    @Vangelis: you’ll have to use the iFrame feature because you’re using jQuery on your site which is incompatible with SmoothGallery.
    If you’re talking about this comment: don’t try to change the file utils.php if you don’t know what you’re doing.

  • daniel says:
    Howdy.
    I’m getting the following:

    Fatal error: Call to undefined function insertsmoothgallery() in C:\xampp\htdocs\wp_sandbox\wp-content\plugins\smoothgallery\smoothgallery.php on line 121

    On a fresh, local wp install.
    Any ideas?

Leave a Comment

Hint: consider reading the FAQ before submitting a question.