Flickr Gallery 0.7

January 8th, 2005

This project is now closed. Please use the much superior FAlbum if you want to integrate Wordpress and Flickr.

This plugin allows users of WordPress (and other clever people who can figure out how to make it work without WP) to display their Flickr photos on their own site. It is advised that users of previous versions of the plugin upgrade to this one. New features in this version:

  • “Friendly” URI generation
  • Link to Flickr slideshow of photosets
  • Support for new Flickr image URLs
  • Security conscious cache file names

Features that were already there include:

  • Flickr photosets as “albums” - complete with descriptions and meta
  • Support for Flickr “notes” feature - just this plugin uses all CSS and Javascript instead of Flash (the plugin’s output looks like this)
  • EXIF data support to display camera settings the photo was snapped with — in addition to the description and meta info from Flickr
  • Valid XHTML output
  • Option to respect photos marked “private”
  • Thumbnail size choices
  • Pagination of albums and photos in albums

Get the latest version in .tar.gz format here or .zip format here.

Ryan has posted a guide for using this plugin with WP 1.5. Unfortunately I still haven’t gotten arround to making it easier to integrate with WP 1.5, but Ryan’s writeup sums it up pretty well.

If you are having issues with the new Flickr authentication API please consider the FAlbum project over at RandomByte. It is a branch of this project, and contains some neat features I simply haven’t had time to implement.

I know some people might be wondering where the interface for adding notes to photos is. For a while I worked at incorporating something like FotoBuzz or FotoNoter into the plugin, but in the end decided it was too hackish because both of those solutions are meant to actually store the notes in the JPEG. To store the notes in Flickr we just have to pass them to an API method. So, if anyone is a Flash guru (I’m not) with a little extra time maybe we could work together to create an interface that doesn’t feel so hackish, both from a usability standpoint and from an integration with this plugin standpoint.

Installation instruction remain approximately the same, but here is a rehash of them anyway.

  1. Put your Flickr photos into photosets
  2. Extract flickr-gallery.php from the archive you download into your WP-content/plugins directory
  3. Configure the settings in flickr-gallery.php to fit your situation
  4. Make a flickr-cache directory, preferably in your WP-content directory. Make sure it is writable by the web server
  5. Make a copy of your index.php and call it gallery.php (or whatever you want)
  6. Extract annimg.js into your site root and put <script type="text/javascript" src="<?php echo get_settings('siteurl'); ?>/annimg.js"></script> in the head of your newly created gallery.php
  7. Add the following to your CSS file and edit it to fit your liking:

    [The requested file http://www.worrad.com/flickr-gallery.css could not be found]

  8. Add the following to your .htaccess file if you want to use “friendly” URLs: RewriteRule ^photos/?(album|page)?/?([_0-9a-z-]+)?/?(photo|page)?/?([_0-9a-z-]+)?/?(page)?/?([0-9]+)?/?$ /flickr-gallery.php?$1=$2&$3=$4&$5=$6 [QSA]
  9. Clear out your flickr-cache directory if you had a previous version of this plugin installed (the old cache filenames weren’t very secure)

Somewhat more detailed installation instructions can be found in README.txt in the download.

If you need more help post a comment here and I’ll help you out, or look through previous comments and discussion here, here, and here.

System Requirements:
PHP 4.1 or greater - with allow_url_fopen enabled (to make remote API/REST calls and download images)

Of course this code comes with no guarantee. If you need support I’ll be glad to help (within reason) — just shoot me an email. If you want to suggest future features or just tell me that you are using my plugin I’d appreciate that feedback too.

Copyright (c) 2005
Released under the GPL license

219 Responses to “Flickr Gallery 0.7”

  1. Rich Manalang Says:

    Dude, you rock! Thanks for adding the EXIF on/off switch in there. This is simply the best WP plugin I’ve found to date… I think it trumps my own WP-Amazon plugin!

    Thanks for all your work on this.

    BTW, just FYI, I’m using this plugin coupled with WP 1.5 to build websites for my clients that include a gallery sourced directly off of flickr… a great solution for clients who don’t have much space on their host. And much better than installing something like Gallery (which in my opinion bloated and overkill in many situations). Flickr buys my clients simple photo management without the hassle.

  2. D. Goodmanson Says:

    Who knows how long flickr will store pics free. Is there a way to store these photos on your own server?

  3. Tom Says:

    D. Goodmanson, http://www.flickr.com/help.gne#3

  4. Mark J Says:

    Take another look at step 6… doesn’t look right. need to add “/annimg.js” to the end, I think.

  5. Mark J Says:

    Also, the “nice” permalinks are quite crufty. /album/ and /photo/ are totally uncessary. /photos/albumname/photonumber/ would be really nice!

  6. Mons Says:

    I just setup the plug-in in my WP 1.5 , but system was show this message “http://www.hkmons.com/index.php?page_id=19″ , can you give me some advise?

  7. Michele Says:

    It seems this version can’t work anymore outside of WordPress because it uses the sanitize_title() function.

    It would be nice to have a slightly modfied version of functions-formatting.php included in the download and a little explanation on how to use the plugin standalone: require this, require that, call the function, voilà. Maybe even a small example (it would be just a couple rows of code).

  8. Michele Says:

    Also, I found a bug: at line 217
    set_id={$album_id}
    should be:
    set_id={$album}
    or the slide show won’t work.

  9. Ian Says:

    Is it just me, or did you forget to change the version number in the header information? Maybe I’m missing something.

  10. Ray Says:

    Ian,

    Yes, initially I forgot to change the version number in the header comments of flickr-gallery.php. It’s been fixed for a couple of days now though. You can change it yourself or redownload it. Goes to show you I need to implement some sort of code repository/versioning system to help manage silly things like that. I’ve used CVS before, but really wasn’t satisfied. I felt like it was kludgy, and overkill for the small projects I do. However, it does seem to be the de facto standard in OSS projects (for better or worse).

  11. Ian Says:

    I’ve noticed a slight bug with Safari - when you click through to get the full sized image, the link to the flickr page (when you click the big pic) ‘leaks’ onto the rest of the page, so that all plain text on the page links there too. Sorry if this isn’t clear, maybe someone else with Safari can explain better. Great plugin by the way!

  12. William Spaetzel Says:

    Hey, I’ve followed the instructions to a T and I am getting this error message:

    An error occurred.  Here is the response from Flickr:
    
    And here is the response after passing through the parser:
    
    array (
    )
    

    You can see it here

    Do you know what the problem might be?

    Thanks.

  13. Thinh Thang Says:

    Hi,

    I’ve followed the directions as best as I can. I’ve made the photosets, I’ve created a new folder “flickr-cache” and made it accessible and I’ve placed the plugin into the right folder and I’ve also activated it through WP-admin. And when I go to http://www.lagerstatten.ca/gallery.php this is what I get:

    Parse error: parse error, unexpected T_ENDWHILE in /home/virtual/site18/fst/var/www/html/gallery.php on line 14

    Any help? Thanks in advance.

  14. Gerald Says:

    Oh well, after I thought I dotted all i’s and crossed all t’s I’m getting the same error that William reported:

    An error occurred. Here is the response from Flickr:

    And here is the response after passing through the parser:

    array (
    )

    For him a chmod 777 on the flickr-cache directory did the trick, but not for me. Any other thoughts to solve this?
    Thanks.

  15. dirkz.de {web|photo}log Says:

    Flickr and Tags all over the Place
    Today I finally received my API key from Flickr, so I could test and finish my work of last weekend. This is version 0.2 of a Wordpress plugin I put together - it’s based on (and heavily re-uses the work of) Ramon Darrow’s flickr gallery plugin that …

  16. Josh Says:

    I have some problems. When I got to my gallery.php page, it is blank. No errors, no nothing. I am using a recent 1.5 nightly build, but it does not work. Can you update for 1.5 please?

  17. Josh Says:

    Now I got it to show something at least, but now I have the error:

    An error occurred. Here is the response from Flickr:

    And here is the response after passing through the parser:

    array (
    )

    How do you fix this? My flickr-cache is already 777.

  18. oso Says:

    I can’t get the friendly URL’s to work. Any advice if my wordpress directory is outside of my main home directory. (IE. my flickr gallery is at http://el-oso.net/blog/gallery.php, but when I put in the rewrite rule into my .htaccess file, nothing shows up at http://el-oso.net/blog/photos/

    Thanks for the help.

  19. oso Says:

    Got it working. Had to add “/blog” before “gallery.php” in the rewrite rule. Amazing plugin.

  20. Mat Says:

    Hi, I’m getting the sets shown on my page but when I click on a set nothing happens, the page just reloads - http://www.matandkerry.com/gallery.php/

  21. Mat Says:

    please ignore - I changed friendly urls to false and it works - fantastic plugin :)

  22. Mat Says:

    Just noticed when I click on ‘view as slide show’ it is not showing my photoset but the latest photos uploaded by everyone at Flickr! How do I get it to show only my slideshow?

  23. Mat Says:

    In the POP up window that has the slideshow the album number is not being past on:

    e.g. when I click on ‘View as slide show’ URL in popup window is
    http://www.flickr.com/slideShow/index.gne?set_id=

    no id number

    should be for example:

    http://www.flickr.com/slideShow/index.gne?set_id=93458

  24. Thinh Thang Says:

    has anyone gotten this to work with WP 1.5+?

  25. Mark J Says:

    Photos no longer show their description.

  26. juso:::blog Ver2.0 » Flickr-gallery設置 Says:

    [...] €ŒFlickr-gallery設置メモ」(Zazie@Tokyo) FlickrのWordpress用のプラグイン「flickr-gallery」というのを

  27. juso:::blog Ver2.0 » Flickr-gallery設置 Says:

    [...] €ŒFlickr-gallery設置メモ」(Zazie@Tokyo) FlickrのWordpress用のプラグイン「flickr-gallery」というのを

  28. gb Says:

    Someone mentioned the problem with Safari and the rest of the page text becoming a link. The problem is on line 367 of the plugin file. It reads:

    $output .= "\n”;


    when it should read:

    $output .= "\n”;


    The anchor tag needed to be closed.

    On another note, I’ve been getting this error from the EXIF data loader: Warning\: exif_read_data(1421487_a97b8d742b_o.jpg): illegal IFD size: 2 + x0B00*12 = x8402 > x0196 in /my/path/to/my/public_html/word/wp-content/plugins/flickr-gallery.php on line 361.

  29. gb Says:

    ack… it rendered the code… should read:
    $output .= "<img src="$image" alt="" usemap="imgmap" class="flickr-photo annotated" />\n";

    changed to:

    $output .= "<img src="$image" alt="" usemap="imgmap" class="flickr-photo annotated" /></a>\n";

  30. DElyMyth - /dev/null » Flickr e WordPress: Galleria Fotografica sul Sito! Says:

    [...] ostro amatissimo blogghino? Ebbene, proprio oggi leggevo da Hanzo dell’esistenza del Flickr Gallery Plugin per WordPress. Ho detto [...]

  31. DElyMyth - /dev/null » Flickr e WordPress: Galleria Fotografica sul Sito! Says:

    [...] ostro amatissimo blogghino? Ebbene, proprio oggi leggevo da Hanzo dell’esistenza del Flickr Gallery Plugin per WordPress. Ho detto [...]

  32. striatic Says:

    http://www.striatic.net/blog/gallery.php

    gives:

    Warning: file_get_contents(/home/.calyx/redelement/striatic.net/blog/wp-content/flickr-cache/089aba578a84d343a377cea644065b1378e752f7.cached): failed to open stream: No such file or directory in /home/.calyx/redelement/striatic.net/blog/wp-content/plugins/flickr-gallery.php on line 522

    An error occurred. Here is the response from Flickr:

    And here is the response after passing through the parser:

    array (
    )

    i’ve chmodded the cache folder to 777 .. maybe i’m not fromatting the cache path properly?

  33. Michele Says:

    Striatic and other with the same probem, I think that might be caused by your PHP host not allowing open() to external URIs.

    Sorry but I can test and verify at the moment…

  34. Ronny Says:

    whoa ok i think i’m way behind everyone in doing this. i don’t know CSS at all but i followed all the instructions but nothing is being created at my gallery.php page.
    its exactly the same as my index.php page except with that addtion line of javascript in it (properly configured too i this, replacing “siteurl” with the actually URL, right?

    http://www.fish8me.com/gallery

    yup sorry to just push the problm to others but anyone can help me out here?

    thanks.
    Ronny

  35. striatic Says:

    you can check the gallery link i included earlier.

    i’ve put the include for PHP info in there and i’m pretty sure it is open.

  36. Ronny Says:

    whoa ok i think i’m way behind everyone in doing this. i don’t know CSS at all but i followed all the instructions but nothing is being created at my gallery.php page.
    its exactly the same as my index.php page except with that addtion line of javascript in it (properly configured too i this, replacing “siteurl” with the actually URL, right?

    http://www.fish8me.com/gallery.php

    yup sorry to just push the problm to others but anyone can help me out here?

    thanks.
    Ronny

  37. Claude Says:

    I’d love the plugin to work for me but here is the message I get…
    Warning: file_get_contents(http://covonline.net/wp-content/flickr-cache//652738947475080503063f1fe851caf99f5bccc0.cached): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/ccf/covonet/wp-content/plugins/flickr-gallery.php on line 522

    An error occurred. Here is the response from Flickr:

    And here is the response after passing through the parser:

    array (
    )
    The URL is http://covonline.net/gallery.php
    Thanks for any help you can give me

  38. kusaeni Says:

    hi thanks for the plugins.. :D
    but i have some error after installing this plugin..the error is :
    Warning: Invalid argument supplied for foreach() in /home/something/public_html/weblog/wp-content/plugins/flickr-gallery.php on line 78

    what can i do?

    thanks and sorry for my english

  39. kusaeni Says:

    updated all its ok i clear my problem,
    bu i have new problem , even i try to explorer my album via flickr-gallery.php i get 404 error …
    I get my pic link http://mydomain.com/weblog/gallery.php/album/seseorang

  40. kusaeni Says:

    sorry for the URI
    http://kusaeni.com/weblog/gallery.php/album/kawan
    and I cant found all my pic in that set

  41. Ian Says:

    kusaeni - I think that it is due to recent changes in WP1.5. It works perfectly on my 6th Jan (alpha) version, but I have the same problem as you on a 31st Jan (beta) version.

  42. Gerald Says:

    After hassling with my PHP host to open calls to external URLS and fiddling with file paths, I’ve FINALLY got this plugin to work, mostly. I need to deal with formatting, but that’s the least of my worries. The only real remaining problem is that when I click “View as a slide show” I get code spewed alongside the actual slideshow. Try it yourself: http://goyaboy.org/blog/gallery.php
    Any ideas why this is happening?

  43. Gerald Says:

    UPDATE to my above post about slideshow and spewed code: This condition only happens with Safari. Firefox does the popup window fine.

  44. Gerald Says:

    Is there a workaround so that the popup slideshow works properly in Safari? If I can solve that, I’d be content.

  45. Gerald Says:

    Ignore both above posts. The problem with Safari was that I’m using Saft to open new windows in tabs automatically–that messes up the slideshow popup window. Except for some small formatting issues (and Flickr going off and on!), all’s well here.

  46. Gerald Says:

    Any reason why the total number of photos per set that is outputted is always one more than the actual number? For example, it’ll say “This photset has 17 pictures” when in fact it only has 16.

  47. Gerald Says:

    Answer to my own question: line 83 should be:
    $album_details['photos'] = count($count_tree['rsp'][$album_id]) - 1;
    instead of:
    $album_details['photos'] = count($count_tree['rsp'][$album_id]) ;

  48. Claude Says:

    I have given up on using this for a gallery. I guess I’ll have to try some other plugin. It just hasn’t worked for me…

  49. Mat Says:

    To all the people who are getting this error

    “An error occurred. Here is the response from Flickr:

    And here is the response after passing through the parser:

    array (
    )”

    The problemis most likely because the path to the Flickr Cache folder is wrong. You’ll need to find this full path info from whoever hosts your site mine is /usr/local/psa/home/vhosts/yourdomain/httpdocs/wp-content/plugins/flickr_cache/ yours wll be something different (unless you host with 34spin the UK). HTH

  50. Neil Says:

    Great plugin, thanks.

  51. NorthSpace Says:

    Flickr Photo Gallery
    Like many out in the blogosphere, I was an early convert to Flickr, particularly when I discovered how easy it was to post photoblog messages from my phone with it. Since then, I’ve been experimenting with it a bit, using…

  52. Chris Says:

    Fantastic plugin, is there any development on a version that will work with wordpress 1.5 ?
    I was looking to set up some kind of gallery, and this integration of wordpress and flickr is IDEAL.

  53. Chris Says:

    Great Plugin, exactly what I was looking for, but I can’t seem to get it to work with wordpress 1.5. Are there any plans for future development ?

  54. Ray Says:

    Chris,

    I do eventually have plans for compatibility with WP 1.5, but life is kind of crazy right now (awaiting a new baby, actually due today!). WP 1.5 is still considered bleeding edge, so I’m not in a real hurry to get to work on it either. If you have any specific information about incompatibilities I may be able to crank out some fixes more quickly though.

    Ray

  55. Scott Says:

    Great stuff Ray, though I wish you would have left it as standalone-capable, since v.07 now requires WP.

    One bug I think is probably in this version… if you have a photoset that consists entirely of private photos the set will still show up as an album, but produces a Warning: Invalid argument supplied for foreach() in... error because it looks like an empty set. Also, the set photo is shown in the main gallery page even though it is marked private.

    thanks!

  56. Basse Says:

    I’m having the same problem with the photo count as others seems to have. Although my only album at the moment contains only one picture the plugin claims that there are two, and shows a link to the previous picture. When I click it the gallery of course fails with an error message (err code 1 “Photo not found”). The photo id is very strange as well (”server”). Does anybody know what the problem is?

  57. Tany Says:

    Fatal error: Call to undefined function: flickr_show_photos() in /home/tany/public_html/dynachrome/gallery.php on line 32

    what IM doing bad?????

  58. Scott Says:

    I had been unable to get the friendly URL’s to work in Wordpress 1.5 until I modified the source of the plug-in so that each URL that was being built ended up having a trailing slash. Example URL: http://www.jarkolicious.com/gallery/album/mobilecam/

    The default plug-in, when simply turning on friendly URL’s, did not work without the trailing slash, such as: http://www.jarkolicious.com/gallery/album/mobilecam

    I can send you the file I have if you desire as everything appears to work without issue in Wordpress 1.5. Just holler and I will be glad to send along what I’ve worked on, which granted, is not much. :-)

  59. viceroy321 Says:

    hi, could you help me ?

    yesterday i successfully installed the flickr-gallery on my wp122-installation.

    today i installed wp15 and liked it, but i am unable to find out, how to install the gallery. point 5 tells me to copy my index.php and rename it gallery.php

    first of all WHICH index.php ? the one in the root-folder or in the themes-folder.

    i would be glad if you could tell me how you installed your gallery. thxia.

  60. viceroy321 Says:

    ok, i solved this.
    now i am getting the same error as striatic. it cannot be the host, as yesterday the plugin worked perfectly on wp122.

  61. schwa23 Says:

    Okay, so to all the people who did get it working with wordpress 1.5, what did you do?

  62. Xawiers Says:

    Copy Your index.php from template You are using to WP root directory and name it gallery.php
    Then edit and change as descibed.

  63. Xawiers Says:

    Changes I did:
    added
    unset($count_tree['rsp'][$album_id]['server']);
    to fickr-gallery.php (94 row)
    because plugin counts not images, but array item count.

  64. SeanW Says:

    Trying to get this working on my site using friendly URLs… I’ve gotten the main page to show up, but whenever I click a collection I get a 404. Not sure what I’ve got set wrong, possible something in my htaccess. My site is here: http://www.seanw.com/index.php/flickr-gallery/

    Any ideas?

  65. John M Says:

    I have the WP 1.5 strayhorn installed and working and installed flickr 0.7. The blog from flickr function works and I`m able to blog individual images from within flickr. The gallery part doesnt work though.

    I modified the index.php found in the themes/default folder and saved as gallery.php in my root dir ( my web root dir and wordpress root dir is the same )

    When pointing to the gallert.php I get this error:

    Fatal error: Call to undefined function get_header() in /usr/home/web/wno55017/gallery.php on line 1

    Am I running into a flickr 0.7/WP1.5 problem here or may it be a problem with my host ?

    Any advice would be appreciated.

    BTW: Very nice plugin, hopefully you will find time making a version for WP ?

  66. Ian Says:

    Ray,
    In my photo gallery at http://www.idowens.com/photo-gallery/ the initial album view is in a single line down the left margin but if you enter a gallery the thumbnails are spread across the entire content column. I am trying to have the initial album view spread atleast two across but changing .flickr-album in my CSS changed not only the main album view but the individual albums as well…I was thinking about something like
    `< ?php
    if ($thisPage=="http://www.idowens.com/photo-gallery/") {
    echo "