“Flickr Thumbnails Photostream” is one of the neatest plugins available to display a random set of photos from a Flickr stream on your WordPress sidebar. I tried out so many plugins before settling with this one for my blog. It builds a local cache of information about your Flickr stream in your website database. As a result it performs faster. Cache does not contain a copy of images. And the plugin is very simple and easy to customize. Which was the main selling point for me.
It’s a wonderful plugin, but it has some issues. Biggest of which is, when trying to update local cache from Flickr, it often times out if your stream has more than 50 images, which is common for many Flickr users.
If you have already used this plugin, you know what I am talking about. “Flickr Curl Function failed to execute. Oops, there seems to be a problem accessing the Flickr information.” is not a very helpful error message :). However in its community pages there is a partially working solution. With bit of time getting my hands dirty with PHP code. I managed to do a pretty much complete solution for the problem. And here it comes. By the way if you guys don’t want to mess with PHP or the plugin code of your sites, this is where to stop.
In this file, I have included two new functions. Nothing complicated. They are just there to format out HTML log messages that are written in to plugin admin page when updating local cache.
Then I also changed getResponseObject function to increase cURL connection timeout to 30 secs, and cURL time out to 6000 secs. This took care of most of the timeout issues.
In this file, I have changed all error messages to use HTML formatting functions I added above. In addition I have added some information messages to make updating process more transparent. With those you will be able to see all the images that are being loaded.
Following the partial solution given on community page, I modified the code to load photo stream batch at a time instead of all at once. Batch size is hard coded to 25. This should pretty much get rid of timeout issue. It will also get rid of 500 photos limit. But I have placed an artificial 500 photo limit in the code. Because it may be best to have only the recent 500 photos shown, if you have thousands of photos in your stream.
In case you guys are using this plugin and having problems with above issues, this might be useful. If you want to apply these changes to your blog, some technical knowledge will be required to edit the plugin file to replace them with code I have posted. Also other changes / plugins you may have in your sites might also conflict with these changes. Just Saying :).
Here is the code. You can find my specific changes if you search for ‘RAKA’ in the code.
With further use and increasing number of photos in my stream, I discovered number of more problems.
1. This plugin store all it’s cache in one WordPress option. At one point it simply stopped caching my newly added photos. I checked option table and found that it uses a LONGTEXT column to store option values. Theoretically it can handle up-to 4Gb of data. But the real limit depends on the packet size being used in database connection as well as available memory. So it’s not that much, and gave me trouble once I have 130 images on this host.
I basically wrote a new update option function for arrays to handle arrays in a slightly different way. If array is longer than a specific number of elements, it will split it in to chunks and each chunk will be stored in a separate option. This will prevent pushing the luck against mysql packet size. This is still bad design. Ideally there should be a separate table for this cache.
2. When there is a large number of photos in the stream, it will result in a large number of calls to Flickr API. You might end-up being temporary blocked from accessing it either by firewalls at the host or Flickr (Flickr says they don’t block so it must be firewalls).
To work around this. I wrote a separate script to download the photo cache in to a file in your local machine. And implemented a photo cache upload facility to ‘Flickr Control’ page.
Here is the modified plugin. Search for RAKA to find changes…
Here is the script to download the data from Flickr to hard disk for uploading to the plugin. You will need to edit the script and provide your Flickr API Key and User ID.
Tags: Flickr, Flickr Curl Function failed to execute. Oops! there seems to be a problem accessing the Flickr information, Flickr Thumbnail Photostream, Flickr Thumbnail Photostream Bug fix, Flickr WordPress Plugin, flickr-thumbnails-photostream, PHP, timeout
5 comments on “Fixing Flickr Thumbnail Photostream WordPress Plugin”
You must log in to post a comment.