Dan Coulter has written a very nice WordPress plugin that lets you easily add flickr photos and flickr galleries to a blog.

I use this over on a number of sites to link to various resources hosted on Flickr.

Unfortunately, the plugin as is does not work very well over HTTPS, since it references resources (javascript, css and flicker thumbnails) over HTTP. At the very least this can leak information about the page you are viewing, but in more modern browsers, the request itself is blocked and the page may not function correctly.

There was no obvious way to push patches upstream, so for now I’ve created my own fork of the code, and have stuck it on github.

Hopefully this’ll be useful to you!

» Visit the project on Github...

One thought on “WordPress Flickr-Gallery plugin with SSL support

  1. I have a number of WordPress sites which use Dan Coulter’s Flickr API powered gallery plugin to render images from an attached Flickr account.
    This plugin appears to no longer be maintained by the author, and I have previously written about having to make a couple of code changes in order to get it to work again.
    Anyway, a little while ago, I noticed that my Flickr galleries had stopped working again, so here’s a fix.
    SSL Redux
    Firstly, the Flickr API now REQUIRES that you connect to it via SSL. However, the Flickr gallery code uses the non-ssl endpoints.
    So, in phpFlickr.php we need to update the endpoint URLs

    var $rest_endpoint = ‘https://api.flickr.com/services/rest/’;
    var $upload_endpoint = ‘https://api.flickr.com/services/upload/’;
    var $replace_endpoint = ‘https://api.flickr.com/services/replace/’;


    var $rest_endpoint = ‘https://api.flickr.com/services/rest/’;var $upload_endpoint = ‘https://api.flickr.com/services/upload/’;var $replace_endpoint = ‘https://api.flickr.com/services/replace/’;

    If you use the database cache, at this point you’ll need to reset it, since you need to rebuild the cache using the correct URLS.
    To do this, open up mysql (or mysqlmyadmin) and open your wordpress database. Next, delete all the rows from the cache, e.g.

    mysql> use wordpress;
    Database changed
    mysql> delete from wp_phpflickr_cache;
    Query OK, 904 rows affected (0.04 sec)


    mysql> use wordpress;Database changedmysql> delete from wp_phpflickr_cache;Query OK, 904 rows affected (0.04 sec)

    Broken Flickr shortcode
    Next, it seems that there was a collision with the Flickr shortcode, seems something was already defining the code but was expecting different parameters (likely Jetpack, but I’ve not really investigated).
    So, I modified flickr-gallery.php to define the shortcodes in the plugin’s init function, after un-registering the existing definitions, and altered the priority so that it was defined last.
    Get the updated plugin on Github…
    » Visit the project on Github…

    Thanks for visiting! If you’re new here you might like to read a bit about me.
    (Psst… I am also available to hire! Find out more…)

    Follow @mapkyca
    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?’http’:’https’;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+’://platform.twitter.com/widgets.js’;fjs.parentNode.insertBefore(js,fjs);}}(document, ‘script’, ‘twitter-wjs’);

    Share this:EmailLinkedInTwitterGoogleFacebookReddit

Leave a Reply