Category Archives: webpage

Tech Nerd Notes

Casual readers can (and should) ignore this post – I’m only putting for up others who may be in the same situation and find this via a google search.  Basically, it explains why if you click on old posts the albums load faster and look better now.

I figured out how to use Apache Mod Rewrite to redirect my existing WPG2 links to the new, faster-loading Gallery 3 versions of the same albums. I think the rewrite rule recommended by the Gallery2 import module in Gallery 3 wasn’t friendly with the rewritten WPG2 plugin generated URLs that I’d been using on WordPress, and I couldn’t figure out why. I’ve been struggling to pull this off for weeks but made the breakthrough today.

I got a great hint from here, and then did some studying on Apache mod_rewrite syntax around the web to make the necessary modifications  ( I wasn’t able to fake my way through it like I can for php). It’s still a pretty rough hack – it takes advantage of the fact that WPG2 is currently using it’s own rewrites to make the URLs pretty by using the album names, which conveniently identically match the imported album names in G3.  So, I added these lines to the top of my public_html .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^v/(.*)$ /gallery3/index.php/$1/ [L,R=301]

So, the WPG2 rewritten links are intercepted by catching the pattern “v/” in the URL, and then it’s forwarded to the G3 version instead.  The preview images for “old” albums you see in WordPress here on the front page of the site are still being served by the old Gallery 2,  but I think I can live with this as it  just costs me some redundant storage space, which is free.   I think the performance might even be better this way for the legacy albums, because I like showing bigger than thumbnail pictures as a preview on the main WordPress page, which G2 can create and cache.   G3 doesn’t have this functionality yet so you’d have to load a larger image and dynamically resize it ever time which uses more bandwidth and is slower.   Knowing what I know now about the syntax, I probably could better understand the hierarchy of rules and rewrite them to work “the right way”, but this is the KISS  solution at this point.

Going forward, new albums will be uploaded to G3 only, but I’ll have to use a post slug to paste the embedding code myself using the Simple Post Template WordPress plugin which is perfect for this.  It pastes this in and then I modify the links appropriately:

 <a href=”″><img class=”aligncenter” src=”″ alt=”” width=”400″ height=”266″ /></a>
<p style=”text-align: center;”>(click for pics)</p>

It would be even better if I could get the WPG3 alpha plug in to work, but it keeps crashing the entire site which I’ve never had a WordPress plugin do before.  I’ve made progress on a few of the issues, but it still isn’t functional, I think I’m just going to need to wait until it’s out of alpha.   The other G3 WordPress plugin’s don’t have the functionality I want – the ability to quickly choose the image from the album tree and make it link back to the parent album.  They all try to do embedded carousels and stuff which are neat but I either don’t like the way they look and/or they are buggy or slow.  I think overall G3 is just a bit too new to have the fully developed support that G2 did, but this should change with time.  In any case, G3 has all the features I need today, and everyone’s complaints about performance should be gone once and for all.


Fitter Happier More Productive

If you are reading this, it means the site loaded from  HostGator, my new, awesome web host.  For you, this means pages should load in a fraction of the time (2 seconds instead of 5 for the main page).  It also means there is a new, updated gallery with a more efficient and modern code base that will also load faster and look better.  A lot of you have been complaining about speed, and hopefully those complaints will now disappear.   For me, the upgrade also yields a number of hyper-nerdy advantages:

  1.  I can have unlimited SQL databases instead of being limited to two, which among other things allowed me to upgrade from Gallery2 to Gallery3 and enables future expansion of the site if I so desire.
  2. Faster upload speeds which should save a lot of time uploading all those pictures of my baby you come here  to admire.
  3. Host Gator uses the fantastic and powerful Cpanel site config software, which is superior to StartLogic’s Vdeck
  4. I can ssh into my server and do stuff like delete a directory in two seconds which could take hours before via FTP.
  5. Rsync support, which will make the backups I do from my NAS at home less of a kludge.
  6. I’ve consolidated domain hosting and web hosting, which centralizes administration for me and should reduce the chance of outages (like last year) since I only have to maintain one account.
  7. It’s much cheaper, due to the aforementioned consolidation of hosts and more competitive pricing – only about $41 a year.
  8. Best of all, Host Gator migrated the entire site for me for free.   This saved me untold hours of debug and frustration (don’t worry, there was still some of that).

The old gallery will stick around for a while – all the pictures are already imported to gallery3, but I need to update the old links or decide it’s not that important.  I wanted to make this new version of the site 100% shiny new before making it live, but this isn’t possible due some of the idiosyncrasies of gallery3 wordpress plugins running on a server that didn’t resolve without host file overrides.   That was fun to write, but it was not easy to figure out.  You don’t care.

And we’re back

Those of you who check this blog much more frequently than I post to it may have noticed an outage – my fault since, amateur webmaster that I am, I forgot that I hadn’t ever transferred my registrar to my new web host.  I was paid up on one, but not the other; repeated e-mails warning of account expiration that I thought were spam and ignored were in fact legitimate.  Anyway, it’s now straightened out.

In other news, I plan to use this site to document the imminent birth of our daughter in real time.  I’ve installed a new WordPress plugin that should simulcast the updates on Facebook as well.  Stay tuned!