Adding Flickr Photos To Your WordPress Blog

by Russell on February 15, 2010 · 47 comments

in how tos,plugins

Many Ways To Integrate Flickr With WordPress

Over the last week, on behalf on a blogging client who has lots of pictures on Flickr, I have been researching different ways on integrating a series of Flickr photos into a WordPress blog. I was looking at two methods of displaying pictures: galleries and slideshows. A gallery displays a number of small thumbnail images and the visitor can click on the thumbnail and a bigger picture is displayed. With slideshows only a single normal size picture is displayed at any one time and the slideshow moves on to the next picture every few seconds.

After some research on Google I tried the following integration methods:

  • Flickr’s own slideshows – using cut and paste of HTML code from Flickr
  • Various WordPress plugins for Flickr – inserting galleries or slideshows using WordPress Flickr Manager, Flickr Gallery, FlickrRss, Flickr Widget, Flickr Photo Album, WP-Flickr and Flickr Slideshow Plugin

Flickr’s Own Slideshow

With this approach you do most of the work in Flickr and then cut and paste some HTML to include the slideshow in your blog. It looks like this

The steps to make a Flickr slideshow are:

  1. Log in to your Flickr account
  2. Select the photos of interest to make a collection
  3. Click the Slideshow button
  4. Click the Share This button
  5. Select the HTML
  6. Paste the HTML into your post on WordPress

My client had a few issues with the Flickr slideshow. The main issue was the lack of captions. Despite many requests to Flickr there is no way to have captions switched on by means of a parameter. It is in the control of viewer (if they can work it out) to switch on “Information” but as well as captions this displays other information such as who took the photo and the date. This tended to spoil the visual appearance of the photo.

The other critical issue was that when he added new photos he did not want to have to rebuild the slideshow and repeat the ‘cut and paste’ exercise.

Flickr Gallery WordPress Plugin

The most appealing of the galleries was that produced by the Flickr Gallery WordPress plugin. This delivers the photos as thumbnails and uses a Lightbox to display them full size. It looks like this:

Screenshot of Flickr Gallery

The steps to build the gallery were:

  1. Log in to your Flickr account
  2. Select the photos of interest and give the group a unique tag
  3. Back in wordpress paste a single line into your post that uses the flickr-gallery shortcode and refers to the tag. For example [flickr-gallery mode="tag" tags="bahamas" tag_mode="all"]

This solved the problem of captioning and made the updating stratghforward: after uploading a new photo to Flickr all you need to do is tag it and it will appear on your WordPress site without having to make any changes. This plugin did the job well for a gallery but what my client wanted was the ability to display his photos as a gallery or a slideshow. Also the plugin also did not work when other Flickr plugins were installed.

Display of Flickr Photos in a Gallery OR a Slideshow

In the end I came up with a solution that meets his requirements of being able to display either a gallery or slideshow, is easy to configure, allows control over captioning, is automatically updated when new photos are uploaded to Flickr and tagged, does not conflict with other Flickr plugins and finally, allows multiple galleries or slideshows per page.

Setting up a gallery or slideshow involves two steps:

  1. In Flickr (or using the WordPress Flickr Manager plugin), you tag the photos with a specific ‘tag’ such as ‘bahamas’ in my example.
  2. On your blog you edit the post and insert a single line of PHP where you want to display your photos.

Displaying A Flickr Gallery

<?php require_once ('flickr_show.php'); echo flickr_show("bahamas","items=10"); ?>

This example will display a gallery of up to ten photos in my flickr account that are tagged with ‘bahamas’. It looks like this

Displaying A Flickr Slideshow

<?php require_once 'flickr_show.php'; echo flickr_show( "bahamas", "type=slideshow&items=10&delay=5"); ?>

This example will display a slideshow with captions of up to ten photos in my flickr account that are tagged with ‘bahamas’ with a delay of 5 seconds between slides. It looks like this

Nassau Cruise Ship

Nassau Cruise Ship

Steel Band at Atlantis

Steel Band at Atlantis

Atlantis Aquarium

Atlantis Aquarium

Grand Bahama Hotel Grounds

Grand Bahama Hotel Grounds

Me Chilling

Me Chilling

Grand Bahama Downtown

Grand Bahama Downtown

Tropical Blue Sea

Tropical Blue Sea

Cool Art in Hotel Room

Cool Art in Hotel Room

Easy To Use But Difficult To Install

While this solution works well, it is relatively complicated to install: I needed to install two PHP files, two javascript files, a jQuery plugin as well the Exec PHP WordPress plugin. This required me to FTP some files on to the server in the right places for it all to work properly. I did this for my client and he is happy. But how can I make the installation easier if I want to use my Flickr Slideshow on other blogs?

The answer is obvious: I need to turn my custom PHP code and javascript into a WordPress Plugin.

New Flickr Plugin For WordPress

The WordPress plugin will do all the installation tasks meaning that once the plugin is installed all the user needs to do is use a shortcode.

Using the Plugin

At blogging time: all you will need to display a gallery of Flickr photos tagged with bahamas is:

[slickr-flickr tag="bahamas"]

If you want to display an automatic slideshow of up to ten photos tagged with bahamas without captioning with a slide transition delay of 4 seconds then use

[slickr-flickr tag="bahamas" items="10" type="slideshow" delay="4" captions="off"]

Plugin Settings

To configure the plugin the minimum you need to do is enter your flickr id – this is the 12 character code that appears in your browsers URL when you click the “You” link when logged in to your Flicker account (it will look something like 47103510@N00) or alternatively use the Flickr Id Lookup facility.

However, you will also be able to change the defaults for:

  • type: allowed values are “gallery” or “slideshow”: initial default is “gallery”
  • items: the maximum number of photos to display: initial default is 20
  • captions: allowed values are “on” and “off”: initial default is “on”
  • delay: the delay in seconds between slide changes: initial default is 5

You will also will be able to change colors and font simply by editing the plugin’s CSS or adding a few lines for custom.css if you are a Thesis theme user.

My goal is to release the plugin within two weeks. About two days to write the plugin and the rest of the time on installation documentation, faq and a training video on how to set up the plugin.

Final Word on The Slickr Flickr Plugin

Today is the 28th February and the plugin has been completed and submitted to WordPress for inclusion in their plugin directory. I hope to put it live and make it available for download early next week.

Check out the Slickr Flickr Plugin Home Page

Google Buzz
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

{ 47 comments… read them below or add one }

zeerebel March 3, 2010 at 7:42 pm

Awesome !!! I was using Flickr Gallery Plugin for several of my website. And all the sudden on one of my website it stopped working. So it really screwed up my website that was built around this plugin. I am going to play around with your new plugin if it works. I will send you a link to that site

z

liz March 3, 2010 at 8:11 pm

Hi Z – Thanks! The plugin is new. Any problems let us know. OUr intention is that it’s simple to use. So please feed back. We’ll do my best to help. Liz

zeerebel March 4, 2010 at 1:47 pm

http://www.fashionistasunite20.com/custo-barcelona/

[slickr-flickr tag="custo" items="10" type="gallery" delay="4" captions="off" slickr-flickr id="84745736@N00"]

Can you provide an example for all the short codes… I had to search all over the place to get a short code for flickr id

for example short code for the width, etc
[slickr-flickr tag="custo" items="10" type="slideshow" delay="4" captions="off" slickr-flickr id="84745736@N00"]

Thanks,
z

Russell March 4, 2010 at 1:57 pm

Z,

There was an error is your example in how you specified Flickr id. The parameter is just “id”.

For example, the following displays a slideshow of ten of Vincent Boiteau’s Barcelona photos with no captions and a 4 scond delay between slides.

[slickr-flickr tag="barcelona" items="10" type="slideshow" delay="4" captions="off" id="84745736@N00"]

Russell March 4, 2010 at 2:06 pm

Z,

There is not a width setting on the slideshow as Flickr support photos at fixed sizes: square, thumbnail, small, medium, large and original. For slideshows use the “medium” size for slideshows in the content area and the “small” size for slideshows in the sidebars. By default the size is medium so you do not need to specify it for most slideshows; only the ones in the sidebars.

BTW you can have large slideshows but only if you have superbig pages over 1024 px and all you photos are available on Flickr at the large size. This is an unlikely scenario. The large size and the original size can more normally be used for galleries which the lightbox pops up the photo in an overlay that is automatically sized according to the photo.

Russell

Russell March 4, 2010 at 2:08 pm

Z,

What did you mean by ” I had to search all over the place to get a short code for flickr id”?

Do you mean how to find your own flickr id?

You can do this at http://idgettr.com/

Russell

Russell March 4, 2010 at 2:42 pm

Z,

At your suggestion I am now updating the Plugin Page to include example uses of each Slickr Flickr parameter.

See http://www.wordpresswise.com/slickr-flickr#usage

Nova March 5, 2010 at 12:35 am

Hi
Really great plug-in. I have a question. In the description of the plug-in you said slickr flickr “Can display slideshows in sidebar widgets”. I’m not sure how this could be done and couldn’t find any documentation. I’m new to Wordpress so might be missing something glaringly obvious. If you could help with this it would be great. Thanks

Nova

Russell March 5, 2010 at 1:16 am

Hi Nova,

Thanks for your feedback on Slickr Flickr

Instructions are as follows:

1. Login to your wordpress admin dashboard
2. Click on the sidebar menu on Appearance and then Widgets
3. Drag a text widget from the content area on to your sidebar
4. Optionally give a title for the widget e.g “My Recent Photos”
5. In the content of the text widget include the short code for the slideshow
e.g [slickr-flickr tag="your tag" size="small"]

In the example you want to set the size as “small” so it uses what Flickr calls its small photos which are around 180px by 240 px (width by height) for portrait format photos and 240px by 180px for landscape format photos.

If the photos you have tagged are all portrait (their height is greater than their width) then add the orientation tag as follows:

[slickr-flickr tag="your tag" size="small" orientation="portrait"]

If you have a mix of portrait and landscape photos then try both orientations in turn and see which one looks best.

Please let me know if have further questions.

Russell

Nova March 5, 2010 at 1:48 am

Hi Russel
Thanks for the speedy response!
I have tried this but instead of the slideshow, the code I insert into the text widget comes up on the sidebar, showing for example the text [slickr-flickr tag="my tag" size="small" orientation="portrait"]. The same code works without a problem in a page or a post. I tried this with several different themes and viewed the browser in both Firefox and Safari. but the result is the same. Is there a way to tell the text widget that I’m inserting some code instead of text?

Your response is much appreciated!
Thanks for making this wonderful plug-in.
Nova

liz March 5, 2010 at 1:57 pm

Hi Nova
Russell left this morning to attend the Wordpress Wordcamp conference in Dublin. Don’t worry though – I will do my best to find out what the issue is and get back to you here.
Liz

liz March 5, 2010 at 3:26 pm

Nova – Thanks very much for your feedback. I’ve managed to verify that there are some blogs where the codes works in the text widget, and some where it doesn’t. We know the fix for this and will update it here as soon as it is ready. We’ll produce an update which should fix it.

Liz

zeerebel March 5, 2010 at 4:46 pm

Hi Russell,
Thanks for getting back to me so quickly. I appreciated it. Yes I had to look for example on how to write the short code syntax correctly.

I will be converting my whole site from Mini Flickr Gallery to your plugin. I just have one more thing to ask
When the plugin is preloading there is white bar that goes across the screen. Can we have it not appear or just be the same size as the 1st image.
You can just tell me which file to edit and which line. I will take care of the rest.

Also is it possible to have the pre-loading icon background transparent
http://www.yournewschoolsite.com/cs/1st-annual-scotia-gallery-arts-exhibit/

Russell March 5, 2010 at 5:54 pm

Nova – Thanks for your patience.
Liz and I have released 1.2 of Slickr Flickr which fixes the problem with running the slideshow in a text widget.
Please let me know how you get on.

Russell

Russell March 5, 2010 at 5:58 pm

Z – Many thanks for your suggestions.

I am currently in an internet cafe in Kilkenny in Ireland as I am attending the 2 day Wordcamp conference. I will get back to you in detail in on Monday

Russell

zeerebel March 5, 2010 at 9:44 pm

Have fun. I might go to the one in Toronto, Ontario, Canada end of the month

z

Ted Kaiser March 7, 2010 at 11:13 pm

Hi Russell,

The plug-in looks great on your site, just what I need. However, although I have no other flickr plug-ins installed, I’ve been trying to implement your plug-in as a sidebar widget using the basic Text widget. The flickr id is 1365296@N23 which corresponds to http://www.flickr.com/groups/torontoshootersclub/pool/. I’m using the shortcode and following your examples.

If I use the shortcode without the tag defined, as expected, the page displays the “Please set up a Flickr tag for this slideshow” error.

However, when I configure for the tag “torontoshootersclub” I get this error:

Fatal error: Call to undefined method WP_Error::get_item_quantity() in /mnt/w0004/d37/s12/b02de94a/www/torontoshootersclub.ca/wp-content/plugins/slickr-flickr/slickr-flickr-public.php on line 37

Any thoughts?

Russell March 8, 2010 at 12:59 pm

Hi Ted,

Many thanks for your comment.

You have uncovered a bug in the plugin which only appears when the Flickr Id applies to a group instead of a user.

I will do an update later today that resolves this. With the new version you will be able to make a change to your Slickr Flickr settings to set your “Flickr Id type” as Group”. Your slideshow will then appear.

Russell

Russell March 8, 2010 at 3:29 pm

Hi Z,

Wordcamp was excellent with very informative presentations from Joost de Valk a.k.a. Yoast on Optimizing Wordpress and Jane Wells on the new features on Wordpress 3.0. I am sure you will enjoy Wordcamp Canada.

If you follow the instructions on the Slickr Flickr home page Customize Slideshow section, you can make the slideshow background the same colour as the background of your page by editing the plugin CSS file.

On your site, login as admin then go to Plugins then Editor, select Slickr Flickr, edit jquery.slideshow.css and replace the #FFFFFF by your background color.

Instead you could use ‘transparent’ as the background color however this only gives acceptable results if all your photos in the slideshow are the same size and orientation.

The issue with the transparent option is that you can see pictures sticking out under the current picture if the current picture is smaller than the default picture (e.g if it was portrait and the other photos were landscape). I will see if I can find a way of using transparent rather than white as a default background by using the visibility style attribute.

Nova March 8, 2010 at 5:38 pm

Hello
Thanks for the speedy fix. The plugin works well in the side bar now. Although every time I go to a different page the slide show in the sidebar starts from the beginning. Is this something I’ll just have to live with?

cheers
Nova

Russell March 8, 2010 at 5:55 pm

Hi Nova,

The plugin displays the photos in the order it gets them from flickr. However it is pretty easy to add an extra parameter start=”rand” to have the slideshow start on a random photo.

The order of the photos in the slideshow will be the same but the starting point will be random. Would this work for you?

Russell

Russell March 8, 2010 at 11:02 pm

Hi Nova,

I have updated the plugin so you can randomize the starting photo by adding the parameter: start=”random”.

You need to update the plugin to version 1.3.

Russell

Russell March 8, 2010 at 11:06 pm

Hi Ted,

Please upgrade to version 1.3. It now supports Flickr groups. You will need to change your Slickr Flickr settings to set your Flickr Id to be a group.

Russell

Russell March 8, 2010 at 11:09 pm

Z,

Please upgrade to version 1.3 of Slickr Flickr.

The slideshow background is now transparent and I am using ‘visibility’ rather than a solid background to ensure only one photo is visible at any one time.

Please let me know if your slideshow is working correctly

Thanks

Russell

Ted Kaiser March 9, 2010 at 5:35 am

Hi Russell,

You rock! I can’t believe how quickly you nailed that bug!

Meanwhile, since I added flickrpress yesterday (thinking it might be a while until slickr flickr would work for me) to the site to display a set of thumbnails in the sidebar which, when clicked, launches a lightbox2 slideshow, I discovered after installing your 1.3 version, that slickr flickr being activated prevents flickrpress from using lightbox2. Instead, when slickr flickr is active, clicking on the flickrpress thumbnails just loads the image into the browser window from flickr.

I have set up slickr flickr to show a thumbnail gallery in the sidebar instead since it also supports lightbox and it is working perfectly! Now, I only need to have slickr flickr installed and activated to meet my needs. However, I think it might be worth it for others if slickr flickr would get along with flickrpress, though I have no idea what the cause is or if it is easy to correct or even if it is maybe the way flickrpress is set up so you can’t address it. Might not be worth the bother to even look into.

Anyway, thanks so much for an awesome new flickr wordpress plugin – I think it will be very popular and I’ll send some PayPal support your way!!

Russell March 9, 2010 at 5:15 pm

Hi Ted,

Many thanks for your feedback.

I will look into the issues with running Flickrpress alongside Slickr Flickr – it is probably a conflict between Lightbox2 and Lightbox

Regards

Russell

Jennifer Soucy March 12, 2010 at 8:23 pm

Is it possible to display more than 20 items? For that matter, I’m not sure why my implementation of this only pulls 14 images – example is here: http://www.erminespot.com/2010/03/12/photos-from-tournament-of-the-lily/ – the actual set on flickr has 40 photos (http://www.flickr.com/photos/11935247@N00/sets/72157622693269867/, all tagged with TourneyLily) and the shortcode I used was [slickr-flickr tag="TourneyLily" items="40"]. Not sure what’s wrong…

Russell March 12, 2010 at 10:17 pm

Hi Jennifer,

Your code is fine. I think this might be a caching issue. Sometimes it can take a while until all the photos appear. Are you using any caching software such as the WP-SuperCache plugin?

On a test page on my blog I used the shortcode [slickr-flickr id="11935247@N00" type="gallery" tag="tourneylily" items="40"] and it returned 20 photos.

The plugin reads from the URL http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=rss_200&id=11935247@N00&tags=tourneylily. For me this also shows 20 photos.

I will investigate further whether 20 is a limit

Regards

Russell

Russell March 12, 2010 at 10:49 pm

Hi Jennifer,

Yes 20 is the limit for RSS. See http://www.flickr.com/help/website/#109651.

It is possible to get all the photos but it means having to use the Flickr API. This is quite a lot of coding and I have no plans right now to take this on. I am working on a new plugin.

There is another simple solution that just might be satisfactory for you. Just have two slideshows/galleries each with 20 photos by having two different tags. One might argue that 40 is too many photos to have in a single slideshow /gallery anyway. But I would say that, wouldn’t I :-)

Very many thanks for your feedback, Jennifer, I will incorporate it into the FAQ and update the Usage Notes to reflect this limitation of 20 photos.

Best Regards

Russell

liz March 13, 2010 at 12:03 am

Actually, there’s an easier way. If you don’t mind tagging your Flickr photos in blocks of 20 – say you were doing a wedding , you might tag photos like this;
wedding-preparation, wedding-church, wedding-lunch, wedding-party, where each set of photos tagged in this way were up to 20 in number for each tag. Then Russell, you could change the plugin to take a list of tags rather than one tag. You could then work around the restriction for the Flickr RSS limit of 20 photos without having to code a load of API stuff.

That would work for me. And maybe Jennifer too?

Jennifer – your photos would benefit from proper descriptions as at the moment you have just the filename showing under each one in your slideshow.

Liz

Jennifer Soucy March 13, 2010 at 1:25 am

@Russell: Thank you for the extremely fast assistance! I’m still deciding my plan for the site – as you could see it’s under a major renovation at the moment.

@ Liz, yes, they would. I’m just lazy and got through tagging them on FB and never got back over to Flickr to add descriptions.

Kerry Hammil March 13, 2010 at 9:37 pm

Awesome plug-in! It’s working really well for me.

It would be great to have the ability to add multiple tags to a single slideshow – I don’t mind tagging photos in groups of 20 but sometimes it would be fun to mix up what’s shown in each slideshow.

Russell March 13, 2010 at 10:32 pm

Hi Kerry,

Many Thanks for your feedback. And for your idea of adding multiple tags.

I will follow the Flickr convention and add ‘tagmode’ with a value of “any”. (See Flickr feed docs).

So if you specify tag=”tag1,tag2″ tagmode=”any” then you will get photos tagged with either tag1 or tag2, subject to a limit of 20 photos in total.

I will add this feature in the next release, Slick Flickr 1.4, which I will publish by next weekend.

Best Regards

Russell

Kerry Hammil March 14, 2010 at 4:03 am

Very cool, thanks Russell!

One more question – how long should it take to see all of the photos from a given tag show up in the gallery? I’ve created a couple of galleries at http://sakuraglasswork.com/blog which are pulling only a few of the photos from a tagset. When I access the Flickr RSS feed directly, I see all of the photos with the given tag though, i.e. http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=rss_200&id7261963@N03&tags=recentgallery2. I don’t have any caching tools installed in Wordpress. Is there anything else I should try or an explicit way to flush the cache?

Thanks,
Kerry

zeerebel March 14, 2010 at 7:16 am

Thanks for all the improvement on your plugin. You should have a donate button.

Thanks,
Z

liz March 14, 2010 at 9:51 am

Hi Kerry – Russell is building the fire (it’s cold here) so has asked me to answer you on his behalf. We first heard about this issue (not seeing all the images straight away) when Lynn Terry reported it. We tried all sorts of tests, and then discovered that you simply had to wait – sometimes as much as 12 hours for all the photos to come through. I think this happens because you have only just tagged the photos? I checked your link and see that there are now 11 photos in the first gallery in your sidebar. So it seems to have caught up with itself. It may just take the Flickr RSS that long to percolate through.

If we find an explicit way to flush it – we will report back here.
Liz

liz March 14, 2010 at 9:54 am

Hi Zeerebel

Russell says (what am I his secretary??!) . . . “thanks very much” for your comment. His hands are covered in coal dust right now from building the fire, but he’ll be back at the keyboard later. He does have a donate button – if you want to do that – it is on the settings page for the plugin on your Wordpress Dashboard.

Liz

Kerry Hammil March 17, 2010 at 5:32 am

Hi Liz and Russell, thanks again for building such a valuable plugin. Letting things sit overnight fixed my caching issues and everything is working wonderfully now.

– K

D March 22, 2010 at 7:46 pm

i am also getting the same thing Ted got when i try to enter the group name., as opposed to the user ID
using version 1.3
any thoughts?
thx

Fatal error: Call to undefined method WP_Error::get_item_quantity() in

Russell March 22, 2010 at 7:52 pm

Have you tried going into Slickr Flickr settings and setting the Flickr Id type to group?

If you have then please let me have you FlickrId and the tag you are using to I can investigate?

Thanks

Russell

D March 22, 2010 at 7:56 pm

just figured it out.
i was using the USER ID instead of the GROUP ID
DOH!
many thanks for following up.
nifty plugin….

Mattias April 15, 2010 at 10:47 pm

Hi.

I have installed the Flickr RSS plugin on my blog (it was included with the theme), and when I previously used my Flickr user photos, I could limit the number of photos to 5. But now when I try to get photos from a Group, then it doesn’t limit the number of photos showing…It shows all the photos from the group!?

Why is this? I’ve changed the settings to “Display 5 group photos”

Russell April 15, 2010 at 11:00 pm

I checked your site, pikei.net, and I note that you do NOT have the Slickr Flickr plugin installed.

My plugin has two separate setings:

Set user type = Group
and
Set Maximum Items to display = 5

You need to go to the Flickr RSS plugin site instead

Regards

Russell

Mattias April 16, 2010 at 12:52 am

Sorry, I just followed a link on the plugins settings page…

But now I noticed that I mixed up the tabs in my browser window. Not strange I didn’t really understand what Slickr Flickr was. =)

Thanks anyway,
Mattias

Russell April 16, 2010 at 1:38 am

Hi Mattias,
No problem, Slickr Flickr is similar to FlickrRSS except that Slickr Flickr does in-place slideshows as well as galleries.
Cheers
Russell

empe July 31, 2010 at 11:44 am

Hi Russel,

i’m using slickr flickr but there is a problem. for the first time, it worked best. but now sometimes the error appears.

from now, i’ve got error message like this

Fatal error: Call to undefined method WP_Error::get_item_quantity() in /home/mppers/public_html/wp-content/plugins/slickr-flickr/slickr-flickr-public.php on line 107

and in post, i’m using this shorcode

[slickr-flickr tag="global-e" items="7"]

i dont know what the problem is. so would you like to tell me how to fix this because i think slickr flickr is the best flickr plugins for wordpress

Russell August 14, 2010 at 2:24 pm

Leave a Comment

CommentLuv Enabled

Spam Protection by WP-SpamFree

Previous post:

Next post: