Inspirated

 
 

February 17, 2009

Rough patches

Filed under: Blog — krkhan @ 3:20 pm

A little while ago I had to code a few fixes for the fGallery WordPress plugin. The patch was released as version 2.4.1-1 and it wasn’t until yesterday that I noticed the “Previous” and “Next” links behaving erratically for my images. Fixing it required a little hair-pulling dance with SQL sub-queries. Anyhow-way, the end product does work as expected. Here’s the incremental diff with the bugfix which should be applied to the 2.4.1-1 release. If you don’t understand what was just said in the last line, you can use the already patched zip archive to have things automatically sorted out.

Tags: , , , , , , , ,

September 21, 2008

Fixing WordPress fGallery plugin

Filed under: Blog — krkhan @ 9:22 pm

For the past two years, I have been using Fredrick Fahlstad’s fGallery plugin for managing images in my WordPress blog. Unfortunately, this excellent piece of software was left unmaintained with the last stable release taking place way back in 2006. For a while now, I’ve had my gripes with some of the things in fGallery. The two options I had were to either (A) fix what was broken or to (B) use another plugin from WordPress Extend.

(B) seemed like too much trouble so I decided to go for the former option and get my hands wet with PHP again. Here’s a list of stuff that I modified in the original 2.4.1 release:

  • Fixed output of special HTML characters in album and image titles to conform with XHTML standards.
  • Modified to send HTTP response “Status:200 OK” back to the client in fim_photos.php. Without this, all of my fGallery pages were returning 404 error code for nice URLs even though they were working in the browser.
  • Fixed an SQL injection vulnerability in fim_rss.php.
  • Fixed image order on album pages and RSS feeds. Without using the table name in the ORDER queries, images were being returned in random order.
  • Fixed date issues in album RSS feeds.
  • Images are now shown in their original sizes in case their width is smaller than 600 pixels. In case they overflow this limit, they are shown in a 600 pixels wide frame with an option to click them for viewing in original size. This was to prevent larger image from messing up blog themes.

Here’s a diff file with the mentioned changes, which should be applied to the 2.4.1 release. I’ve also uploaded a modified zip archive for convenience of those who don’t have access to the patch command.

Tags: , , , , , , , , ,

January 29, 2007

Tragedy of the masses

Filed under: Blog — krkhan @ 2:55 am

As much as I hate Internet Explorer, it’s just not possible for me (or any other web-designer) to completely ignore it. Inspirated used to render perfectly in Firefox and passed W3C’s XHTML & CSS validators without any errors or warnings. However, one of my MSN contacts pointed out that the layout was badly broken in Internet Explorer. After Googling for the cause of a problem, I discovered that IE 6 couldn’t properly handle floated divs without some CSS hacks. Consequentially, peculiar display errors were present on my site e.g. a page showing everything nicely until it was scrolled, making all the boxes disappear.

After editing the style sheet and making few other changes in the page layout, the site is now rendered in IE as expected. Though I still can’t get over the fact that I wasted two whole hours on fixing something that wasn’t broken in the first place. Even worse, I had to do it only because something that I dearly despise is quite popular among the masses.

Tags: , , , ,