So when I made this new theme for my website, I knew that I wanted to incorporate flickr photos on site site instead of using the built in WordPress gallery. There is just so much that I love about Flickr, not to mention the photos are much safer there than they are on my webserver.

It was a happy coincidence that Chris Coyier did this video on CSS-Tricks shortly after I finished the theme. I absolutely love how this gallery looked and knew right away that I would model my plugin after it.

I’ve just submitted this to the WordPress plugin directory, so I’ll wait until that gets accepted to put up a download link. If, for some reason, they deny the request, I’ll put up a download link here. If you want to check it out before that, drop me a line and I’ll send it over to you.




  • Update to enable random images
  • Add custom field for current set on publish with shortcode the set doesn’t have to be defined
  • Clear the float after every row to fix alignment problems
  • Add new options for default number of photos, columns, and type.
  • Add controls for the default small image size and large image size.
  • New option: smallimage. Valid Parameters are s for a small square, t for a thumbnail, m for the standard size. Default value: m
  • New option: bigimage. Valid Parameters are m for medium, b for large, o for the original size. Default value: o
  • Retired option: size no longer exists. Replaced by smallimage
  • Optimize exchange of options throughout the plugin
  • Add new classes for thumbnails to differentiate portrait, landscape, and square images
  • Fix bug that causes multiple sets to be included in the same prettyPhoto gallery


  • RGBA drop shadows to work on any background.
  • New option: size. Valid Paremters are s for a small square, t for a thumbnail, mfor the standard size. Default value: m.
  • New option: columns. Sets the number of columns displayed by the plugin. Default value: 3.
  • New function: fancyflickr(array('set' => 'setID', 'num' => 500, 'width' => 'm', 'columns' => '3')). Gets the photos in the same way as the shortcode. Set the parameters with an array. Default values: set = your lastest set, num = 500, width = m, columns = 3.
  • Fix an issue where Flickr wouldn’t send the URL to the large image


  • First version. Adds a fancyflickr gallery with the use of the [fancyflickr&#93shortcode.

[fancyflickr num=”6″]

Update: Instead of supporting users through the comments on my blog, I will now be supporting users through the WordPress forums here. This will be better for everyone as WordPress already has a great community here. This system is far superior to using comments for this sort of thing. I’m sorry to say, comments for this entry will be turned off.

Published by

Josh Betz

Code Wrangler for VIP & Wisconsin Alum.

75 thoughts on “FancyFlickr”

  1. Hi,

    Great Plug-in!! But i am having issues on my site, the error is as follows:

    Warning: Invalid argument supplied for foreach() in /home/content/z/a/p/zappara/html/bublog/wp-content/plugins/fancyflickr/index.php on line 61

    Any help is much appreciated 🙂


      1. Hi Josh,

        Yes, I have both of them in but its still not working, there is no area for the API secret confirmation? but I have even tried adding it on the end of the API key and still no luck?

      2. Make sure you're using the right userID. It will look something like ########@N##, where # is a number. You can find your userID on this website: Also, make sure you have photos uploaded to your account. Right now FancyFlickr depends on sets, so if you don't have any photos uploaded to your flickr account or haven't created any sets, it may cause problems. If that's the case, let me know and i'll be sure to fix that in future versions.

  2. Thanks for the quick response Josh , i actually did make the mistake with the ID originally but figured it out after a while :), even with those details correct the i still get the error which is focused around line 61 of the index file.

    I have another flicker album plugin running at the moment which requires the same details and the only difference is that the other one has a section in the config for the Secret Auth code section of the flickr API. The main reason i figure it may have to do with this is because i can see actually see the plugin sending the request attempts but it its not being authenticated by flickr

    1. Oh, I see. So you have photos, but they're not publicly viewable, correct? And in order for the plugin to get those photos it needs the secret so that it can authenticate as you and get the non-public photos. I'll look into that, but I'm pretty busy for the next few days. I can hopefully have this fixed by Saturday (12/5).

  3. Installed the plugin and got the right userid and api key from flicker. Now how do I display photos?

    1. Right now the only documented way to display the photos is to use the [fancyflickr] shortcode within a post. If you want to include the plugin within your template, there is an undocumented PHP function that you can use. The code would like like:

      <?php echo fancyflickr(); ?>

      The same options work with this function as the plugin: set="setID" and num="numPhotos". For example:

      <?php echo fancyflickr(array( 'num' => 2 )); ?>

      I will be adding more support for this function as well as more options in future versions.

  4. Just a note. There is a new blog post explaining the deal with authentication at… along with a poll to vote on which direction the plugin should go. I'd like to support authentication, but I have to make sure it wouldn't hurt a majority of the users before I decide to go that route. Even if I decide that would hurt too many users to implement this feature now, I still think that I would eventually like to find a way to do this without changing the requirements for the plugin.

  5. Hi Josh,

    i think this is a really nice plugin and i really wanna use it.

    I followed your instructions, but getting the follow error:

    Warning: curlsetopt() [function.curl-setopt]: CURLOPTFOLLOWLOCATION cannot be activated when in safemode or an openbasedir is set in /home/a7977128/publichtml/wp-content/plugins/fancyflickr/addictedto_flickr/class.curl.php on line 354

    Btw, two images are getting displayed ( )

    You got a solution for this?

    1. It looks like your webhost has PHP in safe mode. You're going to have to talk to them about getting that turned off. As for the two images, I'm not sure I understand the question. I'm guessing you have a set with those two images. Are you trying to display more images than that?

      1. yes, there should be about 30 images shown up.

        are you sure that this is a php problem? just wondering because of the two images which are displayed

    1. The only other thing that I can find is that you need to get open_basedir turned off, but if you're on a big web host they probably won't want to do that. I think what's happening is the script is pulling the first two images and then running into a problem on the third one. Try setting num="2" to see if the errors are generated when you only pull two images.

  6. Testing out this plugin … I have a set displayed on a post page, but when I click a photo all I ever get is a spinning graphic, it never loads the photo. I'm assuming there is some dependency here that I don't have active, but I can't find what that would be.

    The post is here:

    Any ideas?

    1. It looks like the plugin isn't able to get the large versions of the images from your flickr photostream. There could be a few reasons for this. It could be that the privacy settings on your images won't allow for the large images to be viewed, or it could be that there are no large versions of those images created. In order to better diagnose this problem, I would need the URL to your flickr account.

    2. I ran a test using your photoset and for some reason flickr wouldn't give me the url to the large image, but I just patched it and committed the changes to the plugin directory. So within the next few minutes you should be able to upgrade to the newest version with the fix for your problem in it.

  7. Great plug-in!

    However, it seems like that the plug-in show only the latest photo's (of the set). I'ld really like to show all of my photo's (randomly would be much much better:-))

    Could you help me with that? Thank you.

  8. Hi ,thanks for the pluggin ,I love it. But got one problem. when i open the pictures the quality is really low and grainy.

    The flickr pictures are high resolution and if you put the medium size flickr pictures side by side with the one this plugin retrives the quality loss is really clear.

    Whats the cause of this?

    1. Which pictures are you having trouble with: the thumbnails or the larger versions in the lightbox?

      1. hi

        the problem is with the larger versions in the scaled version in the lightbox.

        Merry Chrismas


      2. Ok. I understand now. Since the image is actually too big for the browser window, the lightbox is scaling the images down so that they fit. What I could do is add an option to use smaller versions of the image in the lightbox so that it doesn't have to be scaled.

  9. Thanks Josh, this works a treat!

    It would be nice if you could pull over the title and/or description too but all in all an excellent app. Big thumbs up to you and hope you have a great holiday season!

    1. I've thought about that, but I don't know where I would put them (especially the description). If you've got ideas about where you think they should go I'd love to hear them.

      1. I would say that you can use ALT property and a separator. Or TITLE property.

        Anyway, I checked fancyflickr/addictedtoflickr/ and found out that there is no DESCRIPTION property in $photo.

        Could you please clarify how to extract the description of the photo from flickr?

      2. @henry That's not what I meant by where would I put it. I meant visually on the page, but the title is already in the alt for the lightbox.

  10. Hi,

    First off all, thanks for this plugin, it's exactly what I needed.

    I didn't agree to pay a pro account at flickr AND to pay for a lot of storage for my website.

    I just have a problem. When displaying the pictures, on a test page… my pictures are aligned, not fancy disposed as yours.

    And when open it, it didn't use the lightbox.

    As your are talking about prettyphoto, I've added wp-prettyphoto but it's opening in a blank window, not in a lightbox.

    Any idea ? Sure I miss something….

    1. Well, you shouldn't need wp-prettyphoto. The plugin sets up prettyphoto on it's own, although I guess it wouldn't be a bad idea to just require that plugin. Anyway, both of the issues you are having are with javascript. It sounds like you are having a problem loading the javascript files, but I'd have to look more into it to know for sure.

      1. Well the problem is an incompatibility between the theme Beardsley 1.1.3 par Sash Lewis and your plugin.

        Putting the default theme, the js are correctly called and the effect is working 🙁

        So, either find the bug between them, either choose another theme.

        By the way, Happy New Year…


      2. I'll try to look into this if I get a chance, but if you figure out what the bug is let me know and I'll try to address it in the plugin.

  11. @ Josh: you could make the header of the frame a little bit vertically spacier, and put the descrip right below the title in smaller font. Alternatively, put it in the bottom.

    As an option, you can make it switchable and store its state in a cookie.

    But could you please tell me how to extract the description of a photo using addictedtoflickr library?

    1. Right now there is no easy way. It looks like flickr doesn't have a way to get the description of the photo with the 'getPhotos' method. I'll look into other ways of doing this, but in my opinion, it will require more API calls than it's worth.

      1. Exactly. I've fiddled with the code, but all futile.

        Happy new year!

    1. I'm guessing you a) have no photos in your flickr accounts or, b) the photos are private. There is no authentication setup in this plugin yet, so all photos that you wish to get must be public.

  12. Hi Josh,

    thanx for your great plugin,

    i've found a bug in lightbox image pagination: if more than one different photosets are listed in the page, image pagination count all image with the same rel, so i've patched like this rel="prettyPhoto[gallery-' . $set . '] to count in the right way photoset images.

    An annotation: the theme i'm using (mystique 1.3) have already the lightbox plugin and lightbox effect of your plugin go in conflict showing two times selected image. Maybe useful disable lightbox in your plugin or delete any lightbox effect before apply the prettyphoto effect.

    I hope my fix is useful.

    1. I also noticed that bug, but it wasn't bothering me much for some reason so I didn't think to fix it. That should be an easy fix though, I'll get that up in 0.3.1. As for the conflict between the lightbox, I was planning on dumping all the prettyphoto stuff from my plugin and requiring wp-prettyphoto for this version, but they seem to be having problems with WP 2.9. What I'd like to end up doing is to check to see if wp-prettyphoto is installed and if it's not to give an option to define your own rel attribute for prettyphoto incase it's included in your theme or something.

    2. I fixed the multiple photosets bug. Thanks for the code. Let me know if you find any other bugs.

  13. Hi Josh, firstly thanks a bundle for this great plugin, sadly though after todays update I am getting an error on my site:

    Warning: Division by zero in (removed for privacy)wp-content/plugins/fancyflickr/index.php on line 169

    It kinda leads to a part of my site being shown that I'd rather it wasn't for security purposes.

    Have you any idea what it could be or should I turn it off for just now?

    Again, thanks for this great plugin and I hope I can continue to use it on my photos page.


    1. Sorry. You'll have to go into the options and make sure you setup the new options. I set defaults, but for some reason the defaults only work when you first install the plugin, so when you update it doesn't set defaults for new options. I'll look into it, but you'll definitely fix the problem if you set those options — in particular the one for default columns.

  14. Hi I have set it all up ok but when I click on the thumbnail the next thing that comes up is the pretty photo i-frame with no image inside it, but a message from Flickr – "this photo is currently unavailable". Where have I gone wrong?

    Ta Julie

    1. I'm guessing the images that you have uploaded to flickr are too small and a large image didn't get created. I would try setting your default large image size down in the options and see if that fixes it.

  15. Just a question, is this an easy way to display a single picture with your plugin ?

    The only solution I found is to create a new set in flickr, and put the single picture in this set.

    But my flickr is going to be such a mess in a few time with this way of work…



    1. Currently, there is no way to display a single picture. I'm working on a way to choose any number of photos from flickr to display in a gallery. I should have this ready fairly soon.

  16. I have a new problem.

    I'm trying to display a set and got the error in php (Invalid argument supplied for foreach() )

    So I'm totally lost (I hate when it works but not everywhere. I want everything ok or everything wrong)


    1. That error means it's having problems getting the images from flickr. It could be that the album wasn't ready yet.

  17. The plugin is working for me, but I'm getting a few warnings messages above.

    Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /nfs/c01/h09/mnt/1266/domains/ on line 148

    Warning: getimagesize ( [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /nfs/c01/h09/mnt/1266/domains/ on line 148

    Warning: Division by zero in /nfs/c01/h09/mnt/1266/domains/ on line 180

    1. It looks like this is a problem with your web host. I'd contact support to see if it's possible to enable the option for URL file-access. This should fix all these warnings.

  18. Josh,

    Really excited about using your plug-in. I am getting photos from a set to display, however i'm getting the same warning as DREW:

    Warning: Division by zero in /home7/iworksde/public_html/austintvaddict/wp-content/plugins/fancyflickr/index.php on line 180

    Here's what the line of code says:

    if(is_int($i/$options['columns'])) $pic .= "
    "; // Clear the float after every row

    I also called my hosting tech support and asked them if they would enable URL-File Access, and they said that It's enabled by default.

    Any help clearing this error is much appreciated!


    1. Nevermind. I did some troubleshooting and simply had to match up my short-code parameters to the input fields on the FancyFlickr Tab under Settings on the Dashboard.

      Simply put, the error was generated due to a conflict of parameters.

      Great PLUG-IN. Love it!

      1. That shouldn't generate an error. The FancyFlickr options are meant to be default options, they shouldn't have to match up. I did put out an update that should provide some safety against errors like this in the future, but I'm going to have to look into this to figure out what the real problem was.

  19. hi, i just recently installed ur plugin onto my website that contains wordpress… i filled in all the settings such as ID, api etc for flickr.. n such a dummie..i read ur readme file for directions..n i dont really get it..its not details enough.i sorta need a little step by step.. how do i get it to show on my website?!!?!? n i dont quite understand the shortcode thing you're referring to… thanks :D;

    1. It depends where you want to display the photos. If you want to display the photos in a post you can use the shortcode by putting [fancyflickr] into your post. If you'd like to display the photos elsewhere on your site you'll need to use the php function to echo out the photos: <?php echo fancyflickr(); ?>.

  20. Hi Josh, first of all, thanks for all of your hard work! :0)

    I am using the plugin for the first time, but I get:

    Warning: Invalid argument supplied for foreach() in /mnt/w0508/d03/s25/b0318cdd/www/ on line 152

    Any idea for a fix?

    1. And obviously I've checked all of the previous posts and have the correct requirements ID, flickr API, etc. Could you direct me to the problem?

    2. I see this on my own site, but very rarely. For me, it is usually a problem caused by flickr not responding to the API call. If you're having the problem every time though, it must be another issue. I'll look into it when I have time.

  21. Instead of supporting users through the comments on my blog, I will now be supporting users through the WordPress forums here. This will be better for everyone as WordPress already has a great community here. This system is far superior to using comments for this sort of thing. I’m sorry to say, comments for this entry will be turned off.

Comments are closed.