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.
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
smoothgallerywith its value set toOn - 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:- add a
#at the beginning of line 43 and 44 - remove the
#from line 45 and 46
The plugin now uses the new version; currently SmoothGallery 2.1beta1 with Mootools 1.2.
- add a
- iFrame it
-
Embedding the SmoothGallery inside an iFrame has several advantages:
- the JavaScript for SmoothGallery doesn’t interfere with incompatible frameworks like jQuery, PrototypeJS that you’re probably using on your site
- you can have more than one gallery on a single page
Just add
iframe=1as 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 goth:250andi:falsein 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.
hforheight, use the long version instead, i.e.heightinstead of justh. 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.
- Open the file
config.phpthat comes with the plugin in an editor, search forENABLE_FLICKRandENABLE_PICASARSSand change the value fromfalsetotruefor 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. - 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.
- Open the file
- 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:trueto the custom field or adduseReMooz=trueas 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_THUMBNAILSin the fileconfig.phptotrue. Furthermore make sure that the directorycacheundersmoothgallery/extrais read/writable by the webserver. - Custom links for images
-
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:
- under Advanced Options on the edit screen scroll down to SmoothGallery and use the generated HTML markup
- 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.
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.
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
idof 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=150x150to 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
flickrphotosetto 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 withflickrphotoset. 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 functiongetImageDirectoryand add the attributedirto the shortcode pointing to the path in the array, i.e.dir=0for the first path,dir=1for 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.
633 comments ↓
I think that most people use the visual editor, but that’s just a guess.
You might want to try the TinyMCE Advanced plugin: I haven’t tried it myself but maybe it will give you more control over the HTML – check out the HTML/XHTML button in the menu bar.
really nice plugin! Unfortunately i am getting an “empty” smoothgallery on my page
Smoothgallery seems to work, but there is no image displayed… Here’s my testsite http://www.robeller.net
Thanks for your email response on the validation issue I mentioned the last time. Removing the spaces in the custom field values worked and the site validates already.
Just to share with everyone…
Key
smoothgallery
Value (no spaces)
w:495
h:298
t:true
d:4000
a:false
c:false
l:false
i:false
showInfopane=false
Thank you so much!
I fixed this bug in version 1.6 – so you’re allowed to insert spaces again
This will work:
w : 250
h = 320
Mixing
:and=is possible too.Am I able to have a slideshow in seperate posts?
eg. Monday post about a concert, slideshow of concert photos at bottom.
Tuesday post of random thoughts.
Wednesday post about my fishing trip with slideshow of the days catch at the bottom.
Thanks
Definitely. Just insert the markup in the post about the concert, the fishing trip or your last holidays, add a custom field named
smoothgalleryto these posts, modify the options if you’d like to and you’re all set. The gallery will work in every post.Just to make this clear: it’s not possible to have more than one gallery in one post – but it’s no problem to have a lot of different galleries in different posts.
If enough people want more than one gallery per post I may implement it – but this might be complicated.
The theme I have created is based on the Default theme (copied some code) and has got wp_head() in the header and wp_footer() in the footer.
have used the custom field as advised.
Is there anything that you can think of as to why it will display in the default theme, but not my theme?
nice plugin, its allready work in my blog. I’m newbiz for webblog, so I need ur help. can I load a different size photo to upload in my gallery with automaticly resize? for example: I have 2 landscape photo and 3 potrait photo, how can I do it? and how I can do create the link in another page like as Gallery?
regards, totokah
If you want to integrate the gallery into your theme you don’t have to add a custom field to a post/page – you’ll have to implement the
insertSmoothGalleryfunction in the PHP script (namedsmoothgallery.php). There’s a short video that shows you how to do that.Basically, you’ll insert some if statements to check whether certain conditions are met, i.e. if you want to display a gallery on a page with the id 42 you’d write
if (is_page('42')). You can add more pages like soif (is_page('42') || is_page('23')).If you don’t know how to do this or you’re not that familiar with PHP, tell me what you want to do and I’ll help you hacking it. Although I provide this support for free, I think donating some bucks would be adequate if I helped you solving your problem.
Another thing that might apply to your situation is the problem with Prototype and Internet Explorer. If you’re using Prototype in your theme the gallery might not work in IE: I wrote something about this here.
if you want to show the five photos in one gallery, set the width of it to the width of the photos in landscape format and the height to the height of the photos in portrait format. This way there’ll white space above and below or at the left and the right depending on the photos. But that’s inevitable if your pictures don’t have the same size.
I recommend that you show only pictures of the same size and format in one gallery; e.g. use the Gimp to edit the photos.
http://fbcwaynesboro.org is the main page, (Currently using a simple ajax image fader)
and http://fbcwaynesboro.org/smooth-test the testing page… The box size seems off. I designated the dimensions in the function field as 600 x 375; yet it seems to crop the borders. Any suggestions?
Thanks!
the default is to use SmoothGallery 2.0. If you want to use version 1.2 you’ll have to change line 32 in the code and replace
falsewithtrue.The url: http://mankomanos.ath.cx/fotos
I have some questions.
I have some problems with the wordpress wysiwyg editor . This one clear all tags…and I can’t use your plugin.
how can i do for solve that?
I saw on your video that you have not problem with that. And you have an especial editor. Can you talk about that? plis
Thanks
I’m currently having a problem: I’m running jQuery on my site, so I changed the value to “true” for SMOOTHGALLERY_USE_NAMESPACED. But when I do this, the SmoothGallery won’t show up anymore. Any idea why this happens? Thanks & keep up the good work
Leonardo: please read the first item in the FAQ.
Shay: read this post; maybe that helps.
xkill and others: for problems not related to this plugin but to SmoothGallery please ask your questions in the forums. You’ll find better help there.
Leonardo: I haven’t tried this plugin on WordPressMU so I just don’t know. I’ll have a look at this any time soon.
Marfeal: that’s the right
behavior. I’m looking forward to fix this any time soon.
I’m new here. and may I just act stupid by asking how does this whole thing works?
I still can’t make sense out of it, I mean, I have this theme where smoothgallery is already integrated in it and I have no idea how to change the pictures and customise it.
Your help is appreciated.
thanks.
I don’t know either: please ask the theme author.
If you want to use this plugin read this or watch that. Still not working? Leave another comment.
First off, great plugin. But im having some trouble. I have everything working fine (here) but when i try turn the carousel on it makes it so that the slideshow is no longer displayed. Im turning on by setting it to true in smoothgallery.php and when set to false its perfect. Any idea’s?
have a look at this video.
I’m sorry to tell you that I haven’t got the time to implement this feature. Having more than one SmoothGallery on a single page would add a lot of overhead and would be hard to implement.
If you find somebody who implements this feature or you implement it yourself, send me a patch and I’ll add this to the plugin. Until then you’ll have to manually add the CSS and JavaScript for the various galleries if you’d like to have more than one gallery on a page.
does anyone know why the gallery is working only when implemented in the newest post on the page?
if it is in the second or next it will not work unless you insert the custom field in the first post /not containing any galleries/.
is integrating the gallery into the theme the only solution?
thanks in advance for any comments.
Chek it out:
http://uninuni.com/wordpress-plugin-nextgen-smooth-gallery/
art: it’s possible to have more than gallery on a page but I’m tempted to say that the implementation in WordPress is time-consuming. Currently, I’ve stopped working on that.
Jacob: the JavaScript is missing on your page. Make sure that there’s a call to
wpfooter()in your theme.Garfield: that’s looking great.
Leave a Comment