Rants, Web

Gallery3 + WordPress 3.2.1 = FFFFFFFUUUU


I know that a WordPress on top of Nginx isn’t all unique but unfamiliar to me, but this fiddling was ridiculous!

I have set up a Gallery3 install (since they’ve stopped maintenance of Gallery2 I believed that I should also use the most active and stable version). Oh boy, was that awful: I realized late that they have intended to depend on Javascript; signs of a design approach I am strongly against. Later, after much pain of creating a custom theme for my gallery (deserving it’s own rant mainly containing one four-letter word rhyming with ‘truck’), I wanted to be able to import images from this to WordPress using the Gallery3 Picker plugin. Given that it had rave reviews and a good method of integrating with WordPress, I thought the install would be painless. I guess anything mainstream written in PHP is going to be anything _but_..

So, after much frustrating FFFFFFFUUUUUUUUUU away from sharp pointy objects and a large crowd of random victims, I found this (gallery3-picker/picker.php line 320):

if ($http_status == 302)

Now, the plugin tries something smart: it first tries the /index.php then if that fails retries with the plain URL – assuming that it does SEO rewrites.

If you took a moment to examine my Nginx setup you may have noticed this line:

location ~ \.php$ {
        try_files $uri =404;

.. So if it cannot find a file, it throws a 404 – naturally. Delving into it, the final URL the plugin was after adds a /path/to/rest at the end: so the actual URL hit for me would return 404 at the first pass, not to retry the next.

I have my tweak at least:

if ($http_status == 404 || $http_status == 302)

Geez, it’s as if you are hungry but the only option is a greasy burger at a fast-food joint you wanted to avoid. Then you discover that your patty is underdone and they demand that you use their unintuitive stove to cook it yourself. Hmmm.. this food talk makes me slightly less angry and more hungry – time for lunch!