Fixing That “Could not open lock file” Gallery Error

(Preface: Gallery is an open source tool for hosting photos on your website.)

So, suppose you upgrade your copy of Gallery to the latest version (1.4.4-pl4 as of this writing), you follow the upgrade instructions, re-run the configuration wizard and then you get a goofy error such as this:

Warning: fopen(/home/abischof/httpdocs/albums/2003/photos.dat.lock): failed to open stream: Permission denied in /home/abischof/httpdocs/gallery/platform/fs_unix.php on line 55

Error: Could not open lock file (/home/abischof/httpdocs/albums/2003/photos.dat.lock)!

Yeah, that happened to me. Fortunately, there’s a known workaround. As it turns out, it’s not Gallery’s fault if this occurs — it generally only happens if your web host mucks up your permissions while upgrading your PHP setup. The solution? Just set the permissions on every file in your “albums” directory to 777.

As noted in the workaround, this is fairly straightforward if you have shell access to your web host (just run “chmod -R 777 albums” from the parent directory). But, if you only have ftp access, then you’ll need to set each set “albums” to 777 manually; and, if your ftp client can’t recurse through directories, then you’ll need to manually hop through each directory within “albums” and manually set every file to 777. That should do it :).

Customizing Gallery Footers

I posted some Thanksgiving photos on Friday and I was trying to figure out how to add footers to my Gallery pages to signfy my Creative Commons licensing — under the license I chose, you can “copy, distribute, display, and perform” the photographs as long as you give me credit (commercial use requires separate permission).

Writing some HTML & CSS wouldn’t be hard, but I wasn’t sure which Gallery files I needed to modify. After some searching, I soon found EclecticPixels’ Gallery customization tutorials (the Gallery forums can also be handy for this kind of thing). And the part that applied to me was the second part on headers and footers. But, you only want to add a header or footer, then you may find the steps here easier (for one thing, EclecticPixels’ tutorials create extra nested tables, which isn’t necessary).

I’ve only tested these directions with Gallery 1.4.1, but they should work for Gallery versions from 1.4.1 to 1.9x (Gallery 2.x may be completely different).

  1. If it’s a Creative Commons license that you’re adding, you’ll need to go through their license selection wizard if you haven’t already. That will then take you to a “Mark Content” page which has some pre-built HTML code which you can either use as-is or as a starting point.

  2. In any case, the Gallery files you’ll need to modify are in the “html_wrap” directory which branches off your main Gallery directory. You’ll need to grab “wrapper.footer.default” if you’re adding a footer (or “wrapper.header.default” if you’re adding a header). If you’re downloading these from your web host, remember to set your ftp client to ASCII mode.

  3. Before making any changes to the file(s), save them without the “.default” extension (as “wrapper.footer” and “wrapper.header”, respectively) to ensure that the original files stay intact (the customized files need to have these new filenames anyway). And, if you’re only adding a footer, you don’t need to bother with wrapper.header.* (and vice-versa if you’re only adding a header).

  4. Open up the file in a text editor and, if your editor has syntax highlighting, you can set it to PHP highlighting mode (this will make the file easier to read, but there’s no consequence if your editor doesn’t have syntax highlighting for PHP files). Then, scroll to the bottom of the file and add any HTML code that you want in your footers. (Here’s my finished wrapper.footer for an example.)

  5. If you need to add any CSS to accompany your HTML, you can add that to the bottom of your Gallery skin’s CSS file (which can be found at http://yourdomain/path/to/gallery/skins/skin-name/css/embedded_style.css). And, for an easy back-up path in case your changes are overwritten when you next upgrade Gallery, you may want to make a note of your CSS changes in a separate file as well.

  6. That’s it :). Just upload your new wrapper.footer (and/or wrapper.header) into “html_wrap” and the updated embedded_style.css (if you even changed that) on top of your old CSS.

(You can see my new footer on any of my Gallery pages.)

Gallery & Web Hosting

From the gallery-announce mailing list, I learned that a new version of Gallery (1.3.4) has been released. It seems to be mostly a maintenance release, though there are some new features as well:

New features for v1.3.4 include: the ability to download your gallery to burn to CD or browse offline, additional photo print services, auto-rotation of JPEGs when possible, and the ability to add new customized description fields to photos. […]

I’m almost ready to post my pictures from my trip to Greece and, along with this new Gallery release, I’ve been thinking about my web hosting.

I currently have hosting with Logjamming and it’s been fine so far. They do Wil Wheaton’s hosting and that’s what drew my eye to them in the first place. I have their Standard Account plan and for just $5/month it includes 100 MB space and 300 MB transfer/month.

That used to be adequate, but I find that I’m now bumping into those monthly limits regularly (both their space and transfer limits, as their quota-daemon is only too happy to remind me). I could upgrade to their Advanced Account, which allows for 200 MB storage and 1 GB transfer. But, especially with the digital photography and my new camera, I can only imagine that those limits may not be enough in the long run either (?).

So, I’m open to suggestions on web hosting (or even if you think Logjamming’s Advanced Account will be fine after all). I’d like to keep it to around $15 or less per month, which is why I’m not really considering Logjamming’s Deluxe Account ($25/month x 12 months/year = $300, yikes).

The two main web apps that I used on Hand Coding are Movable Type and Gallery. So, I’d need a web host that would work with both of those — Movable Type isn’t much concern, but Gallery is another story ;).

Sure, Gallery can probably be installed on most web hosts. But, even on a decent hosting provider (like Logjamming), it can quickly become almost more trouble than it’s worth if any library isn’t in its default location.

However, the Gallery project has a list of “Gallery certified” web hosts. And it’s not just lip service either — the Gallery team does a test-install on each host before approving them. And since an Easy Gallery Install(TM) would be a godsend, I figure that list could be a good starting point.

And, looking over those hosts briefly, OpenSourceHost caught my eye. For $14/month (when paid annually), they offer 350 MB storage and 7 GB transfer/month (that takes into account their Gallery Special which adds an extra 100 MB storage and 1 GB transfer when using a Gallery referral code).

Well, let me know what you think. When I started with Logjamming, I paid for a year in advance, but my year is just about up. So, this could be a good time for me to switch, if I were to do so.

Gallery Installed, Finally

After some effort, I successfully installed Gallery yesterday (it wasn’t quite as easy as I was hoping it would be).

In older versions, Gallery used to insist on the NetPBM library (installation requirements). However, it now supports ImageMacick as well. During the installation/configuration script, the pre-screening reported that NetPBM was found (“All 12 files found”) on my host. So, when presented with the pull-down to choose between NetPBM and ImageMagic, I just went with that…

The rest of the installation seemed to go fine. I then went to upload some photos and I started getting errors (the mind-numbingly vague “Unable to make thumbnail(0)”, whee). So, I re-ran the configuration script and turned on debug-mode. Then, after trying to upload photos again, the debug-mode diagnostics reported that one of the NetPBM files couldn’t be found (I’m still not sure whether this was the fault of Gallery or a mistake on the part of my hosting provider).

Since the NetPBM files were shared among several domains on my host and out of my reach (permissions-wise), I decided to attempt to install the latest version of NetPBM on my own. So, I uploaded those files to my host, set their permissions (755) and re-ran the Gallery configuration script. I told it the location of these newly installed files, but I just couldn’t get Gallery to recognize them (yuck).

I was about ready to give up, but then I remembered that Gallery supported ImageMagick as well. Of course, the pre-screening script didn’t affirm the discovery of ImageMagick files, so I wasn’t even sure if they were installed. But, I tried it anyway — setting the image-library in the configuration-script to ImageMagick — and it just worked (whew).

Don’t get me wrong — Gallery is a great program. But, its installation seems to become a bit wonky if it veers off its best case scenario. And, the “installation instructions” (if you can call them that) were a bit terse. Some of the steps were on the level of asking a novice cook to “julienne a potato”. Sure, that may be straightforward to an experienced cook, but it would also be understandably tough if you don’t even know what julienne means.

(And, just to clarify, I don't consider myself an expert cook, nor did I know what julienne meant until I looked it up just now.)

Gallery Installation Tips?

I took some pictures at the last Slashdot Meetup (with Jason’s camera), and I’d like to put them up with Gallery (Gallery is a free web based photo album). I know several other people that have installed Gallery, but are there any tricky parts to the installation?

Gallery requires PHP, of couse, but I’ve confirmed that my hosting provider includes that. And, looking over their abbreviated installation instructions, it seems so simple ;).

  • Check your requirements. You will need access to a server running Apache and PHP, with NetPBM installed and running. - details
  • Download the gallery files. Create an appropriate directory and install the files on your server.
  • Create an albums directory and set its permissions.
  • Run the configuration script. You will need to know your root directory and URL.
  • Set up some albums and add images.
  • That's it!

With any luck, installing Gallery is no more difficult (or even easier) than installing Movable Type, which I made it through without much trouble.

PS: Byran, I would have TrackBacked one of your posts, but I couldn't find a TrackBack URL there :(.