Blog

Flickrpress: WordPress Flickr widget

Flickrpress screenshotFlickrpress is a widget/shortcode function to display items from Flickr in the sidebar or within pages and posts. This widget supports:

  • Flickr RSS feeds
  • Photostream
  • Filtering by tag
  • One or more photosets
  • Favorites
  • Displaying random items

Other features:

  • Choose from three different thumbnail types
  • Lightbox/Thickbox are supported
  • Data is cached locally to lower server load
  • Secure Flickr API used, to eliminate the risk of damage to your server, unlike some other Flickr widgets
  • Flickrpress is a multi-widget, so you can use more than one instance (e.g., one in your sidebar, one in your footer)
  • Use as a shortcode to insert into posts and pages — multiple instances supported in the one entry

Flickrpress uses the excellent phpFlickr library.


My latest project:

The Cartographer banner


Download

Download Flickrpress at the WordPress site.

If you like Flickrpress, please consider buying one of my products.

Installation

  1. Unzip the package, and upload flickrpress to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Add the ‘Flickr Widget’ to your sidebar and configure, or see the ‘Shortcodes’ section for information on use in pages and posts

If you wish to use content from anything but an RSS feed, you will need a Flickr API key. This can be obtained from Flickr

If you wish to use Lightbox, you must first install the Lightbox plugin.

Shortcode

Shortcodes are snippets of text that can be inserted into pages and posts. These snippets are replaced by various generated content. Flickrpress provides a ‘flickrpress’ shortcode to display images from Flickr within a page/post.

Available parameters:

type One of: ‘rss’, ‘photostream’, ‘sets’, ‘favorites’
url URL for RSS feed
api_key API Key for types other than RSS
account Account name, email or ID
sets Comma-separated list of photoset titles
tags Comma-separated list of tags to filter by (for photostream view)
view One of: ‘squares’ (view as squares), ‘proportional’ (proportional thumbnails) , ‘large’ (large thumbnails)
count Number of thumbnails to display
paging ‘true’ to show page navigation, to move back and forward through pages of images (implemented using AJAX)
random ‘true’ to display randomly
lightbox ‘true’ to use Lightbox
columns Number of columns of images to display

Example:

  [flickrpress type="photostream" api_key="xxxxxxxxxxxxxxxxxxxxxx" account="michaeltyson" count="30" paging="true" lightbox="true"]

Styling

Flickrpress comes with CSS styling, but if you wish to modify its appearance, such as adding frame borders, simply style the “flickrpress-container” class. See style.css for more.

FAQ

I’m seeing “Flickr is currently unavailable” messages

You may have an incorrect setting: To see the actual error message, open your server’s error log and look for Flickrpress messages. How you do that depends on your host – on mine, Site5, the error log appears in the WordPress folder; on others, you access it through a web interface). If you can’t get to it, open up the file includes/interface.php in the plugin’s folder, and change error_log on line 22 to echo – then any messages will be printed to the screen. You’ll want to change it back afterwards so your visitors don’t see those messages.

Changelog

1.0.2

  • Added Thickbox support
  • Compatibility fix for PHP 4

1.0.1

  • Bugfix in navigation javascript encountered when Lightbox isn’t installed

1.0

  • Implemented AJAX-based navigation through pages of images
  • Added shortcode documentation
  • Caching for shortcode and php calls
  • Removed ‘css’ option in favour of always including CSS
  • Fixed conflict between shortcode and widget versions
  • Fixed bug in loading all photostream items

0.3.2

  • Fixed a warning when using shortcode

0.3.1

  • Fixed a packaging snafu

0.3

  • Support for use outside of sidebar

0.2.1

  • Bugfix for displaying random favourites

0.2

  • Now able to be styled as described in http://www.webdesignerwall.com/tutorials/css-decorative-gallery/. See style.css for more info.

0.1.1

  • Bugfix for when only 1 random image shown

0.1

  • Initial release
, , . Bookmark the permalink. Both comments and trackbacks are currently closed.

54 Comments

  1. Posted April 8, 2010 at 1:13 am | Permalink

    Hi there!

    This is a great plugin, that I’m excited to use, but I’m having problems similar to others, getting the error message: “Flickr is currently unavailable.” (and no photos displaying)

    I tried adding a widget to the sidebar – then when that didn’t work, I tried a simple way of using the shortcode in a page: [flickrpress type=”rss” url=”http://api.flickr.com/services/feeds/[email protected]&lang=en-us&format=rss_200″ ]

    …and even tried a few variations on a more advanced way – which is the display I’d prefer: [flickrpress type=”sets” api_key=”XXXXhiddenXXXX” account=”[email protected]″ view=”square” paging=”true” lightbox=”true” columns=”5″]

    I am having success using my API key with other plugins, it just seems that this one’s not working.

    Any guidance you can offer would be greatly appreciated. ~ Willo

    p.s. Once working, will my detailed type=”sets” shortcode list the names of the sets with that display?

    • Posted April 8, 2010 at 1:19 am | Permalink

      I fixed the view=”squares” & tried this:

      [flickrpress type=”rss” url=”http://api.flickr.com/services/feeds/photos_public.gne?i[email protected]&lang=en-us&format=rss_200″ account=”[email protected]″ view=”squares” lightbox=”true”]

      still no worky.

      But, I was able to get the widget working with RSS. However, I’d like to be able to display photosets w/ titles (if this plugin does that)

      Thanks :)

      • Posted April 8, 2010 at 10:24 am | Permalink

        Hi Willo,

        The best way to figure out what’s going on is by looking in your server’s error log (how you do that depends on your host – on mine, Site5, the error log appears in the WordPress folder; on others, you access it through a web interface). If you can’t get to it, open up the file includes/interface.php in the plugin’s folder, and change the error_log part on line 22 to echo – then any messages will be printed to the screen.

  2. Posted April 8, 2010 at 5:44 pm | Permalink

    Hey Michael,

    I followed your inst fro Willo…here’s what the echo error is reporting… “tent/plugins/flickrpress/includes/interface.php:190 (flickrpress_load_items_rss()): RSS load of failed Flickr is currently unavailable.”

    Any thoughts on this one? Again, your really helping me out, Thank You!

    A

    • Posted April 8, 2010 at 5:47 pm | Permalink

      that above error was for a screwed up shortcode…

      I changed it back to ” [flickrpress type=”sets” api_key=”c4e09e3bfb28434abf717c4e4f3294d6″ account=”RocketCity4x4″ view=”squares” count=”10″ lightbox=”true”]

      and now there isnt an echo’d error log….just says flickr is currently unavailable again…

      • Posted April 8, 2010 at 5:50 pm | Permalink

        Should I alter the rss request in the php? or should I ad the rss url to the shortcode maybe?

        man Im learning way too much, getting dangerous! LOL

        • Posted April 8, 2010 at 6:01 pm | Permalink

          GOT IT WORKING! sort of…..LOL

          Had to alter the shortcode type=”” setting….to rss, photostream also worked…but only after i added url”” to the values and copied the rss url into the shortcode there…

          *****However….. the lightbox feature isn’t working properly….

          please see here… http://rocketcity4x4.com/test/gallery/pics

          it opens up 2 lightboxes..one with an extra vertical sidebar of the other pics….

          thougths?

          A

  3. Posted April 8, 2010 at 6:05 pm | Permalink

    UPDATE: GOT THE LIGHTBOX FUNCTIONALITY WORKING!!!!

    had to add the shortcode parameter for columns=”3″ and change the count from 10 to 9….

    but its alive! Lots of styling to do to get it fitting properly….

    I’d like to thank you one more time Michael. I really appreciate it.

    a

    • Posted April 8, 2010 at 6:33 pm | Permalink

      Ok,

      it appears that there is aconflict between thickbox and lightbox preventing the lightbox functionality from working properly….

      Thickbox is included with wordpress install now i gues, cause i venre installed it…

      how could I get rid of thickbox?

  4. Posted April 8, 2010 at 6:38 pm | Permalink

    it appears that thickbox is included in the wp-ecommerce plugin…and thats who’s calling it into the mix…

    anythoughts on getting around this issue?

    • Posted April 8, 2010 at 8:57 pm | Permalink

      Ok, its dead again…im fried.

      no lightbox functionality at all…

      using the following shortcode: [flickrpress type=”rss” api_key=”c4e09e3bfb28434abf717c4e4f3294d6″ account=”RocketCity4x4″ url=”http://api.flickr.com/services/feeds/[email protected]&lang=en-us&format=rss_200″ view=”large” count=”9″ columns=”3″ lightbox=”true” paging=”true”]

      link to problem:(new location) http://rocketcity4x4.com/test/gallery/

  5. Posted April 8, 2010 at 9:40 pm | Permalink

    Hi Michael,

    Thanks for letting me know how to view the server error messages. So with RSS selected as the source feed, I get the following error message:

    blog/wp-content/plugins/flickrpress/includes/interface.php:190 (flickrpress_load_items_rss()): RSS load of http://api.flickr.com/services/feeds/[email protected]〈=en-us&format=rss_200 failed

    Switching the plugin to API key, I get the following error message:

    blog/wp-content/plugins/flickrpress/includes/interface.php:146 (flickrpress_load_items()): Couldn’t get photo URL for user:

    Please help! Many thanks in advance

    Teg

  6. Posted April 8, 2010 at 10:41 pm | Permalink

    Got it working by deactivting the lightbox2 plugin, and installing/activating shadowboxjs…

    however, shadowboxjs is limiting the functionality to one page, even if the same feed overflows to multiple pages…

    the battle rages on.

    a

  7. Posted April 11, 2010 at 10:41 am | Permalink

    Hi, why not adding the option to show pictures from the whole flickr community, simply filtering them “by tag”? I’m creating a small blog for an even smaller village :-), and I’d like to display pictures with the tag “preggio” regardless of the account, group, photostream, and so on. And maybe even an option to display pictures taken “by place” could be nice (i.e. something like http://www.flickr.com/places//Italy/Umbria/Preggio). Thank you, have a great day!

    • Posted April 11, 2010 at 11:24 am | Permalink

      That’s a good idea, Bruno – I’ll add it to my ‘to do’ list.

    • Michael
      Posted April 17, 2010 at 9:28 am | Permalink

      Hi again, Bruno – I had a thought that didn’t occur to me before, strangely: Most Flickr listings come with RSS feeds. So, unless you want random display from all photos in that list that were ever taken (or the ability to navigate through them all), you can add the RSS feed in Flickrpress, and that’ll display the latest photos.

      The link to the RSS is usually at the bottom – in the case of the Preggio places listing, it’s entitled “Latest”.

  8. Posted April 14, 2010 at 5:58 pm | Permalink

    So how could I just replace the lightbox finctionality with thickbox…?

    This is the best flickr plugin, and fits my needs perfectly, but the other requirement I have of using the wp-ecommerce plugin is forcing thickbox and displaying a vertical column of thumbnails within the thickbox overlay aswell….

    Michael, thanks.

    a

  9. Posted April 16, 2010 at 12:51 pm | Permalink

    I dig the plugin, its working great for me! Looks and functions perfectly. My one concern is over validation of my site. I’m kind of a stickler for having a valid page. When I turn on flickrpress, my site throws a bunch of errors and warnings. I’ll include a link to the validator results, but just wondering if I’m doing something wrong, if its something I can clean up, or if it’s something I have to live with? Thanks in advance!

    Validator Results

  10. soren bjoern-anderse
    Posted April 17, 2010 at 9:10 pm | Permalink

    Hi there. Nice plug-in, however I get this error on my site above the pictures from Flickr: Warning: set_time_limit(): Cannot set time limit in safe mode in /hsphere/local/home/namenloss/hippiephobia.net/wordpress/wp-content/plugins/flickrpress/includes/interface.php on line 257 Warning: set_time_limit(): Cannot set time limit in safe mode in /hsphere/local/home/namenloss/hippiephobia.net/wordpress/wp-content/plugins/flickrpress/includes/interface.php on line 257

    2nd question: Is there some way/ setup to have the pluging sort pictures that are mixed between landscape and portrait format? Right now it looks a bit messy

  11. Posted April 24, 2010 at 7:38 am | Permalink

    Nice idea but this plugin doesn’t work. I get “Flickr is currently unavailable”. I did as instructed but still no luck. My feed is http://api.flickr.com/services/feeds/photoset.gne?set=72157623919939928&[email protected]&lang=en-us

    No reason why that shouldn’t work when plugged in to the widget. Unless I have the feed link wrong which doesn’t seem to be the case.

  12. Posted April 25, 2010 at 5:48 pm | Permalink

    Hi Michael,

    I’m getting the dreaded, ” Flickr is currently unavailable.” and my error log shows:

    [25-Apr-2010 11:17:49] wp-content/plugins/flickrpress/includes/interface.php:190 (flickrpress_load_items_rss()): RSS load of failed

    Which appears to me to be missing the RSS feed that I’ve seen some people show in that error.

    I’m currently using the API method but I’m hoping this might help you track down a bug. I’ve seen others show no RSS Feed in the error as well. And I do have an RSS Feed in the widget. BTW. I’m using it as a widget. :)

    Kermit Woodall http://kermitwoodall.com

  13. Posted April 27, 2010 at 10:21 am | Permalink

    I was always getting the “Flickr is currently unavailable” myself. What I did was choose the “Favorites” option and just entered my Flickr username. For some reason the widget always hangs on the other options. I had to delete this widget today because it was slowing down the load times of my pages anyway. Looking for something else now.

  14. Benjamin Knight
    Posted May 4, 2010 at 3:28 pm | Permalink

    I’m having trouble where this widget is taking so long to load that it’s causing my home page to load very slowly. It would be nice if there was an option for the flickr data to be read in through AJAX so that the loading occurs after the rest of the page content has already been loaded.

    • Posted May 4, 2010 at 4:32 pm | Permalink

      Hi Benjamin,

      That’s a very good idea – I’ll add it to the todo list

      Cheers!

  15. Cas
    Posted May 4, 2010 at 11:02 pm | Permalink

    Doug C.- using the username instead of the email worked for me as well – THANKS!

  16. Posted May 6, 2010 at 8:09 am | Permalink

    Could I get an example on how to get this to work using php code?

  17. Posted May 21, 2010 at 9:14 pm | Permalink

    hi Michael,

    is there anyway to install flickrpress on wordpress.com?

    thanks for your help!

    cheers! Nancy

    • Posted May 29, 2010 at 2:42 pm | Permalink

      Hi Nancy! I’m afraid I actually have absolutely no idea! I’ve never used a hosted WordPress account, so I’m unsure about how it all works. It may be worth posting the question on the WordPress forums, though. Good luck!

    • Posted June 6, 2010 at 6:24 am | Permalink

      Nancy,

      You should be able to install the plugin automatically through your admin section -> under ‘Plug-ins’ – ‘Add New’ Then search for FlickrPress and follow instructions to install and activate

      Cheers

  18. Posted May 28, 2010 at 6:39 am | Permalink

    Wondering how I can call different Container Styles? I have a few uses for this plugin, but all have different float values (left,right,center)

    • Posted May 29, 2010 at 2:35 pm | Permalink

      Hi Dave,

      How are you using the plugin – with widgets, or within a page using a shortcode (or in the template with the PHP function)?

      If you’re using a shortcode/PHP function, you could wrap the call within a div, and style it using the div’s identifier. Depending on your theme, you should be able to style widgets using their unique identifier (like, say, #flickrpress-12334567) – have a look at the page source to figure out what selector to use to address the individual widget.

      • Posted May 29, 2010 at 11:09 pm | Permalink

        A little bit of both actually! PHP for my front page, and then another page which would have both shortcode and PHP. Do you have a small example I could use? I’m a bit slow on the uptake but can modify nicely what I see for examples. Dave

      • Posted June 6, 2010 at 12:56 pm | Permalink

        Try:

        <div id="my-flickrpress-id"><?php flickrpress(array( /* options go here */ )) ?></div>

        Then, in your stylesheet:

        my-flickrpress-id { /* Your styles go here */ }

        For the widget, just “View Source” in your browser, and look for the flickrpress widget – exactly what markup appears around it is dependent on your theme.

  19. Posted June 6, 2010 at 6:30 am | Permalink

    Michael

    Thanks for this … works perfectly !!

    I spent a frustrating amount of time going through various other (buggy and conflicting) plugins and options trying to get a more dynamic rotating header which is fed from my Flickr photostream – this does the job fine (on a page with the php code)

    Cheers :o)

    • Posted June 6, 2010 at 1:01 pm | Permalink

      Excellent! That’s good news =)

  20. Dukiejc
    Posted June 8, 2010 at 9:41 pm | Permalink

    Michael, This is a great plugin! It works great for me but I was wondering if there is a way to scroll through your entire photoset from the lightbox? Basically, I set it to show 3 thumbnails in the sidebar and the lightbox only shows those 3 images. Is there a way to not have to click “next” to get the next set of 3 thumbs? thanks -dukiejc

  21. Posted June 18, 2010 at 1:02 am | Permalink

    I’ve added support for setids using the option set_ids by changing around line 309 of interface.php by adding one line and modifying another.

    added this line: $setIds = explode(‘,’, $options[‘set_ids’]); modified to this line: if ( in_array(strtolower($set[‘title’]), $setTitles) || in_array(($set[‘id’]), $setIds) ) {

    Here is the finished work starting around line 309 inside function flickrpress_load_items_sets of interface.php:

    if ( !$sets || (time() - $options['set_data_cache_time']) > FLICKRPRESS_CACHE_MAX_AGE ) {
        // Need to compile a list of set ids from the list of set titles
        $sets = array();
        $setTitles = array_map(create_function('$a', 'return strtolower(trim(strip_tags($a)));'),explode(',', $options['sets']));
        $setIds = explode(',', $options['set_ids']);
        $flickrSetList = $flickr->photosets_getList($accountId);
        if ( $flickrSetList === false )  {
            FPERR("Couldn't load set list: ".$flickr->getErrorMsg());
            return array();
        }

    foreach ( $flickrSetList['photoset'] as $set ) {
        if ( in_array(strtolower($set['title']), $setTitles) || in_array(($set['id']), $setIds) ) {
            $sets[] = $set;
        }
    }
    
    $options['set_data'] = $sets;
    $options['set_data_cache_time'] = time();
    

    }

    Hope it can be of use for someone else, and maybe even be added to the plugin.

    Thanks for the great plugin!

    -Steph

  22. Posted June 27, 2010 at 11:21 am | Permalink

    i asked over on wordpress.org, but i’ll add it here too :)

    http://wordpress.org/support/topic/414889

    i’m wondering if its possible to call the new 640px flickr image, rather than the 500px image?

    thanks for the amazing plugin!

    darren.

  23. erwin
    Posted June 30, 2010 at 7:54 am | Permalink

    This is a really great plugin for WordPress! Thanks so much for making this available. I was wondering if you could add a boolean function to the tag search on the photostream, like “OR” “AND”?

    Thanks.

  24. TMik
    Posted July 8, 2010 at 7:21 pm | Permalink

    I installed the plugin and had it was working great for a while. I’m now getting a virus alert in the browser with the plugin. I confirmed it was the plugin triggering the virus, but not sure if its the actual plugin code, Flickr API or something else.

    Here the link of the notice: http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=http://gwennshop.cz/images/nq2zs/p002_1_03.php&client=googlechrome&hl=en-US

    • Posted July 8, 2010 at 9:49 pm | Permalink

      Hi TMik,

      It seems to me that it’s pretty unlikely that this has anything to do with the plugin, by my estimation – the URL you mention, ‘/images/nq2zs/p002_1_03.php’ doesn’t look like anything that this plugin would produce. What makes you think it’s specifically the plugin, and not that you’ve just been hacked?

      Cheers, Michael

      • TMik
        Posted July 8, 2010 at 10:03 pm | Permalink

        Michael – You’re right. Sorry for the misinformation. Turns out is was just a coincidence that the virus message was appearing when the plugin was activated.

        I do love the plugin and it works great with no problems. Again, my apologies and nice job on the plugin.

  25. Chris
    Posted July 15, 2010 at 9:03 pm | Permalink

    On the widget for the sidebar, I keep getting the error (flickrpress_load_items()): Couldn’t get account: Invalid auth token

    But I’m using an API key that works for another app. I even received another Flickr API and entered that into the widget, but I still get the error.

    Any ideas?

  26. Posted July 21, 2010 at 6:24 pm | Permalink

    Hi,

    Im having a problem with the plugin where i always get the error: Flickr is unavailable. I switched it to echo the errors and got the following:

    wp-content/plugins/flickrpress/includes/interface.php:190 (flickrpress_load_items_rss()): RSS load of feed://api.flickr.com/services/feeds/[email protected]&lang=en-us&format=rss_200 failed

    It is added to the site as a widget. It worked perfectly on my old hosting, but since i moved the site to new hosting and a new domain name it doesn’t work.

    Any suggests would be greatly appreciated!

    Many Thanks.

    • Posted July 21, 2010 at 7:41 pm | Permalink

      Hello – “feed://” isn’t a valid scheme. You need “http://”

      • Posted July 21, 2010 at 9:43 pm | Permalink

        Excellent! Been playing with my mind for ages!

        Thanks Very Much.

  27. Posted July 24, 2010 at 7:23 am | Permalink

    Been doing some testing to figure out why for some only the Favorites option works. Everything other option gave me the dreaded, “Flickr is currently unavailable” message.

    Here is what I was able to find that might help many other. It appears that the order of your feed options breaks FlickrPress. Using the widget this works…

    http://api.flickr.com/services/feeds/photoset.gne?&[email protected]&lang=en-us&set=72157623919939928&format=rss_200

    This didn’t work….

    http://api.flickr.com/services/feeds/photoset.gne?set=72157623919939928&[email protected]&lang=en-us&format=rss_200

    But here is the really strange part. After I switched the order and made sure the ‘nsid’ was the first option and got it working I went back and put the ‘set’ in front. Every time after that the plugin worked.

    Oddly this was also the case with the short code as well. Very strange.

    So if you do get the message and can’t get anything to load from flickr try formatting your RSS link like so with the ‘nsid’ first and not the ‘set’ first like flickr gives you…

    http://api.flickr.com/services/feeds/photoset.gne?&[email protected]&lang=en-us&set=72157623919939928&format=rss_200

    • Posted July 24, 2010 at 12:23 pm | Permalink

      Great discovery! And…extremely bizarre. When I get a moment I’ll see if I can work a remedy into the plugin

  28. Posted August 1, 2010 at 6:16 am | Permalink

    Sorry Michael: I have tried every solution on here and I cannot get it to work. Still get the “Flickr is currently unavailable” message.

    Moving on.

    All the best.

  29. Posted August 20, 2010 at 11:14 pm | Permalink

    Hi michael, thanks for the plugin, I’m finding it really useful, and no doubt will use it more as my new site develops. I’ve noticed that, on first opening the page in my browser (firefox), I occasionally (but regularly enough to be worrying) get the message “Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode in “path removed/plugins/flickrpress/includes/interface.php on line 257″. If I refresh the page, the message goes away, and everything looks fine. I don’t see it again until I navigate away from the site, and back again, when it occasionally shows. Any ideas?

    Sean

    • Posted August 30, 2010 at 5:22 pm | Permalink

      Hi Sean – That’s not a big deal: set_time_limit() is a function used to stop the script from falling over if it runs for too long. Your web server’s in safe mode, which disables it, so you may see the script die with an error for long (more than 30 seconds) operations.

  30. Posted September 3, 2010 at 11:31 am | Permalink

    Hi,

    First of all – like your plugin…

    Second – I don’t seem to find any option to set the columns for widgets… so I did some tweaking myself…

    Added these lines to flickr.php

    under flickrpress_defaults (line 276); 'columns' => 4,

    and inserted this piece of code after line 561;

    <label for="flickrpress__columns"> <input type="text" id="flickrpress__columns" name="flickrpress[][columns]" size="4" value="" />

    And somehow I managed to get it working… :D