WPG2 plugin hacking

4179

I finally got the time (at work, muahaha) to try to fix the problems I’ve had with the WPG2 plugin, displaying and linking to images from my Gallery2 photo gallery in my blog. The default behaviour of the plugin is to display a Gallery2 thumbnail (the 100×100 pixel with watermark, if you check my gallery) and open an embedded gallery page inside my blog. This screwed up everything and just looked disastrous, so I said “fuck it” and didn’t think more about it.Today I thougth that there has to be a way to get the plugin to work as I want it to, namely to display a down-scaled full size image (i.e. not the little square thumbnail) and to link to the standalone gallery instead of the embedded page. I succeeded to 99%.

Problem 1: linking to the standalone gallery. This was actually easier than I thought. I tried to google around for a simple answer but everyone was talking about using the mod_rewrite module for apache or manually hacking the plugin scripts – sigh… After having browsed the plugin scripts and doing som grepping, I found that in the WPG2 plugin configuration, which is usually done automatically, there is an option to change the path to the embedded gallery page. So from the WordPress admin page, go to “WPG2” and click the “Show/Hide manual configuration form” where you find a field for the URI to the embedded page. Now here comes the best part: the embedded page takes the same parameters as the main.php page in the standalone gallery. So I just changed the URI to point to the main page of my standalone gallery which is gallery2/main.php. Simple as that – the embedded page is now history!

Problem 2: changing the size of the thumbnails. This was also quite easy, once I found the little checkbox saying “FullSize” in the WPG2 plugin configuration page “Blog Image Options”. When this checkbox is checked, the plugin retrieves the fullsize version of the image instead of the thumbnail, which is exactly what I wanted. The size of the image is then determined by the value in the “Tag Thumbnail Maximum Size” field. Problem solved.

Problem 3: changing the style of the image. I also wanted a custom look for the images inserted in a blog posting. This is where the “Custom classes” fields in the same page comes in handy. Just define an own style, say “blog_image” and type that into one of the boxes. Then edit the stylesheet of your current wordpress theme and add a class style named “blog_image”, e.g.

.blog_image {float: left;border: 5px solid black;}

That’s basically it. The only remaining problem is that I can’t get the blog image centred without getting whitespace between the image and the border on the sides. There’s just too many stylesheets determining the style of the image, so I need the DOM inspector for Firefox to see what the problem is and I don’t have that here at work.

Advertisements

2 Comments

Filed under Geek speak, Photography

2 responses to “WPG2 plugin hacking

  1. What I want to do on my blog, is every few hours take the oldest post and move it to the
    front of the queue, all automatically. Anyone know if there is a plugin that can do this or
    a simple way to set up another plugin to do this (use my own feed perhaps)?
    Thanks.

  2. Thanks mate! Your solution to ‘problem 1’ saved me a lot of work! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s