Howto: Gallery2 pics in sidebar

It is actually a bit of a story, and it began with upgrading my installation of gallery from version 1 to version 2. Gone in version 2, at the time, was syndication via rss of pictures. That’s originally how I had the pictures published to the right side of my blog. There’s an RSS plugin for Gallery2, which I did get to install, but it didn’t completely work since it sends the images as enclosures, not just links to the image.

That led me to find other ways to get pictures from Gallery onto a remote site. Here a discussion form thread on calling random image code, but its by fetching html. The types of images to show are in a the pipe-delimted list can be “randomImage;” or “recentImage"e;. IF you list multiple then it’ll get, for example: 3 random pictures as below:


You’ll want to cache the output so that the pictures rotate every couple hours, not with every hit to page you have them on. I have some sample PHP code for caching here.