Category Archives: Gallery3

Galleries Moved from Gallery to Zenphoto Platform

This change was major enough to warrant its own post. Near the end of June, the Gallery Project announced it was going into “hibernation” with further development being stopped. So, I started looking around for something else. As you can guess from the title of this post, I finally decided on Zenphoto. I had tried Coppermine in the past but I didn’t like it then and it really hasn’t changed since. I also looked at Piwigo, but I didn’t like a few aspects of it. The main one being that its URLs were rather ugly and creating Apache rewrite rules, or internal PHP script handling, would be almost impossible to tell the search bots the new location of my images and pages.

The whole process took me a couple weeks but it involved a lot of behind the scenes work, much of which being specific to my situation so this post will mostly be a summary. Some individual steps could warrant a complete post themselves. Following is a brief (hmm, maybe not LOL) explanation of the steps I took for the switch:

  • Installed Zenphoto locally on my PC to test it out and get familiar with the UI (I have Apache, PHP, and MySQL installed on my PC). Decided on a supplied theme to use as a base (picked Garland) and what plug-ins I needed to do what I wanted.

  • Downloaded the full-size images from my current Gallery at my webhost and placed them into the Zenphoto albums directory. More specifically, I used Putty for shell access on my webhost to create a zip file of each main album and its sub-albums and then used FileZilla to FTP them to my PC and unzipped them. I already had the images locally but I wanted to make sure I was working with the actual files from my Gallery as the file names would prove to be crucial.

  • Created a test sub-domain and database at my webhost for Zenphoto and installed Zenphoto there. Since my webhost has Imagick installed, I changed the graphics option to use it instead. I prefer it over GD as it keeps all the EXiF and IPTC information intact. It was during this time that I uncovered a bug with the image quality setting having no effect with Imagick. Here’s the bug I filed on it and the solution. I changed the code and it’s working fine now.

  • The next phase of the operation is probably what took the longest. Zenphoto is file system based and creates its albums and such from the actual file structure and imports any EXiF and IPTC information it finds to be used as the image’s title, description, original date, tags, and so on. While I technically did not have to do this, I wanted to make sure all my images had the appropriate ExIF and IPTC information stored in them. Some had no information, some just the description and the newer ones had both the title and description (the Gallery software also imports these). Most did have the original (image taken) date in them but some were even missing that. None of the images had IPTC tags stored in them.  We’re talking about 100s of images, over 1,000 in one gallery.

    Initially I used a combination of Exifer, Irfanview, and Exiftool to manually update the images but quickly realized what a pain in the butt it was going to be and the amount of time it would take. Since laziness is the mother of invention, I decided to write a couple PHP scripts to cycle through the images of a specific album, look the images up in the Gallery database to get the image’s title, description, and tags and, using the command line interface of Exiftool, insert that information into the IPTC fields of the actual image (.jpg files). In order for this all to work, the file structure and file names on my PC had to match what was stored in Gallery’s database. I wrote one script to handle the title and description and another script to handle the image tags since those dealt with different parts of the Gallery database. Once I got this to work properly, I made pretty quick work of getting my images set with appropriate ExIF and IPTC information.

  • After getting my images updated, I decided this was the time to create any new albums and/or sub-albums. For example, in my main gallery, I divided up the old single Nature and Astronomy album into Animals and Plants, Astronomy, Mountains, and Weather sub-albums.

  • Created new zip files from the albums on my PC and uploaded them to the webhost in the Zenphoto albums directory. I then used shell access to unzip the files. The Zenphoto software recognized the new albums and images and imported all the ExIF and IPTC metadata from the images into the appropriate database fields. This saved me from having to manually tag the images and so on.  Some parts such as the album names, album descriptions, and image ordering were tweaked at this time.

  • The next process involved creating a set of Apache .htaccess rewrite rules in conjunction with some PHP code to redirect the bots and links that were out there to the new page and image locations. The PHP code was similar to what I had done in the old gallery where it intercepts the gallery’s 404 handling to see if the image actually does exist and, if so, what its new location is and directs the browser there with a 301 redirect. This only works when the image file names remain consistent and are unique. This PHP code also logs what it is looking for (the actual request and my parsed out image portion of the URL) and if it found it or not. If it doesn’t find a match it returns control to the gallery 404 processing. In the case of Zenphoto, I just insert a function call at the beginning of the theme’s 404.php file: if (found_missing_item()) exit; The benefit of this code is that I can also move images around and not worry about creating new rewrite rules.

  • The next step was to flip the switch and point my live gallery sub-domain to the Zenphoto directory and see what happened.

  • The final step was to update the various gallery widgets on my sites to work with the new gallery database and file structure.

Whew!! :) From this point forward I just kept tweaking various parts of the theme, and debugging my PHP code and Apache rewrite rules when I noticed certain things cropping up that I had missed. Like I said earlier, some parts of this could warrant their own post if I really went into the nitty gritty with code examples. If anyone wants to actually know how something was done in more detail, please make a comment. :)

Website Changes for August 2013

Main Site Updates

Nothing that big since last time. I’ve updated the Winamp Info and Firefox Configuration pages to reflect the latest changes to those programs. I also tweaked the YouTube Playlist players a little to show a starting thumbnail image because for some reason they just went all black. Seems the embed code you get from YouTube is slightly different depending where you get it.

Blog Updates

WordPress Version 3.6 was released a couple days ago which I have since upgraded to and this post is a test of that as well. This update does include a new default theme called Twenty Thirteen. I’m still playing around with the theme locally on my PC to see if I really want to change to it. If I end up making it look like what I’m using now (colors and appearance) then there’s really no point in changing themes LOL. Haven’t looked at it close enough yet to determine if there’s some feature or ability that only the newer theme has.

The process was the same as always: backed-up the database and files and then clicked the Update button. I then reapplied some of the custom code tweaks that I do (there’s only 3 modifications that involve the core files).

Gallery Updates

Gallery released version 3.0.9 at the end of June which I have since upgraded my galleries to. It addressed a couple minor security vulnerabilities that were discovered. Due to the amount of code tweaks I have, several of which are in the core files, updating Gallery is a bit more involved. I do make back-ups of everything first as I invariably forget to re-modify something LOL. A lot of Windiff is involved to compare changes between versions. Anyway, I’m not going to go into the details as it’s specific to my case and needs.


That’s all the changes that come to mind at the moment. I’ll add to this during the month if need be. :)

Website Changes During June 2013

Main Site Updates

The biggest changes were adding a YouTube player to my General MIDI page that plays some videos I made while playing karaoke (has lyrics) MIDI files in XMPlay. I also added a #okwx (Oklahoma Weather) Twitter search widget to my Weather page. I sometimes wonder if my site is slowly starting to suffer from feature creep with each button and widget that gets added. I think I’m still OK LOL. :)

Gallery Updates

Gallery released version 3.0.8 at the end of last month which I have since upgraded my galleries to. It addressed a couple late-minute security vulnerabilities that were discovered.

Blog Updates

WordPress v3.5.2, a Maintenance and Security update, was released yesterday which I’ve upgraded my blog to. Performed my normal process of backing-up the database and file structure before applying the update.

Company of Valor Updates

I’ve been slowly going through my Company of Valor (An EverQuest guild that used to exist on the Quellious server about 9 years ago that I was the leader of.) website updating the code and correcting several issues. I think the Resources/Links page had around 50 broken links on it  8-O LOL. Some of the pages there were made 13 years ago. A lot of the pages don’t have closing paragraph tags and other such coding practices that were the norm back then. It’s kind of a low priority deal so I do a few pages a day when I’m in the mood. :)

Website Changes During April 2013

Main Site Updates

Yesterday I noticed that my YouTube players on my Entertainment and NASCAR pages had quit working. They were completely blank. My guess is they finally pulled the plug on these old style players. So, I grabbed the latest embed code, using iframes, for my playlists and replaced the old players. I guess the added benefit with these newer players is that they will detect if your browser supports HTML5 or not and display the appropriate HTML5 or Flash based player. You need to be part of YouTube’s HTML5 Trial for it to show the HTML5 version, provided your browser supports it.

Speaking of HTML5, Firefox 20 added support for videos encoded with h.264 in certain operating systems (namely Windows 7 and above at the moment as the OS comes with the codec). This is disabled by default, however. You need to go into about:config and set media.windows-media-foundation.enabled to true.

Gallery Updates

April 22, 2013: Gallery released version 3.0.7 which I have since upgraded my galleries to. It addressed a couple late-minute security vulnerabilities that were discovered.

It seems that not long after Gallery v3.0.5 was released that Gallery v3.0.6 came out to fix some bugs. So, I’ve updated my galleries accordingly (actually did this a few days ago). Exact same process as before.


That’s all for now. Anything else I do this month I’ll update this post. :)

Galleries Upgraded to Version 3.0.5

Gallery LogoOver the past couple days, I upgraded both my Gallery and my EverQuest II character’s Gallery to version 3.0.5 using these upgrade instructions. I’m not going to go into all the gritty details about propagating my code tweaks and such but did want to mention that I did make database and file backups prior to doing anything. One tip I will pass along is that any code tweaks you make within the core files, be sure to add comments like /* mrh added/modified the following code to do xyz */ so that you can do a project wide text search on “mrh” (in this example) to find everything you’ve modified. Trust me, there’s no way I could remember what all I’ve done to however many files LOL. :)

So far everything in both galleries seem to be working fine. :)