WPG2 patch to display random images from a specified album

I recently installed WPG2 and Gallery2 to my block to manage the photos and images which are related to my blog entries and generally to store the photos taken by me. I found WPG2 quite good, but it lacked a feature I missed: To display random images from an album which is related to a specified blog entry. What I mean, that I take a bunch of photos, import them into my gallery2 installation and then write a blog entry about them. This patch allows to add a “related-gallery” -custom field to the blog article, which the Sidebar Grid Block then picks up and it displays random images from that album.

Usage instructions:

  1. Install WPG2 (I’m using 2.3.0.2 3.0.2)
  2. Apply the patch: WPG2 patch against WPG 2.3.0.2 to add support for Related Gallery to Sidebar Grid Block
  3. Add the Sidebar Grid Block to your layout from Presentation -> Widgets
  4. Configure the Sidebar Grid Block from WPG2 -> Sidebar Grid Block
  5. Upload some photos to your Gallery2 installation
  6. Obtain the album id where you uploaded your images. The album id can be found from the URL of the album. This is an example from my album: “http://blog.juhonkoti.net/gallery2/main.php?g2_itemId=37”. In this url the album id is 37. Obtain this numeric id.
  7. Write a blog entry and add a custom field from the bottom: key is related-gallery and value is the id you just obtained from the step 6.
  8. All done, go and see the results.

Known problems and limitations:

  • Currently you need to obtain the album id manually by looking the Gallery2 urls. This could be made easier by some kind of wizard.
  • You need to use the Custom Fields -feature.

I’ve asked Ozgreg, the founder/programmer of the WPG2 project, if he could add my patch to the main trunk of WPG2. Let’s hear if he likes this :)

4 thoughts on “WPG2 patch to display random images from a specified album

  1. I definitely have to give that patch a go on my own blog. Sounds just like something I’d like =P

    Thx for the comment @ blogi.ylivalot.us. I like the new theme better my self also =) I think the messy feeling was due to the small images at the front page ;)

Leave a Reply

Your email address will not be published. Required fields are marked *