New Photo Gallery Created

If you look up, you’ll see a new link: Photo Galleries.

I wrote some code to leverage the existing gallery engine that I’m using and display a nice listing of the galleries that I have to show. I’m running the exec-php plugin to allow me to actually embed code in my posts and pages, which increases WordPress’s versatility exponentially in my opinion. I used it a while back while running my old D&D Blog, but haven’t really had need to dabble with it for quite some time. I wanted to find a “simple solution” for a gallery display and I think this is it.

I had to make a minor code change to a NextGEN Gallery module in the end, but it was amazingly trivial. While I’ve been working on this for about 4 hours, it was also while chatting, browsing and watching The Big Lebowski – so I definitely didn’t have my head buried in code the whole time. The biggest issue was tracking down the NextGEN Gallery issue, which turned out to be the addition of just two lines of code. I still want to add some error handling/sanity test code to the gallery wrapper, but it’s ready to go as-is.

Definitely feeling good about finally having a nice gallery browser. I’m sure I’ll extend it over time.

Feb 28th, 2009 | Posted in Photography, Programming, Site News
  1. Amarnath Ravva
    Jul 16th, 2012 at 00:21 | #1

    Hi,

    I’m making a similar photo gallery with nextgen and I’m stumped in how to pass the variable in the same way you did for pagination (i.e. &nggpage=2). Could you tell me what you did?

    Thanks
    Amar

  2. Mike
    Jul 16th, 2012 at 06:05 | #2

    Amarnath,

    Originally, I needed to add explicit support to NGG to accept and pass a query string. I added the following section to the get_permalink() function in nextgen-gallery/lib/rewrite.php:


    // 6. If There's A Query String, Pass That Too
    if (isset($_SERVER['QUERY_STRING'])) {
    $url .= "/?".$_SERVER['QUERY_STRING'];
    }

    While I’m a bit behind on updates, the last upgrades I’ve done didn’t require this hack to work properly and the query string was being passed without additional changes.

    Beyond that, NGG handles the pagination all by itself. I just had to ensure that it was passed along to each successive page call.

    I just leverage nggtags gallery shortcode and pass in the tag via the gallery= query string.

    So ultimately, the code boils down to printing out something like:

    [nggtags gallery=$gallery]

    where $gallery is one of the valid tags that I’ve used to tag my images in NGG.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>