Setting up a Gallery with Wordpress

Simply put: People like snooping on others. That means that people love looking at pictures online. For that reason, an image gallery can be a worthy edition to a blog (or any site for that matter). Obviously, the site needs to be suitable for such a thing, and you need to pay some attention to the kinds of images you will put up there. For example, if your site is a very professional business site, you probably don’t want to have pictures of the CEO’s dog. But, hey, you never know. The thing about image galleries is that they can:

  • Provide interesting content for people who just like to snoop
  • Provide traffic as people click from image to image
  • Raise likability of the site’s author by making him/her seem more real (hey, he actually does exist!)

With all this in mind, and because I thought it would be a fun addition, I have set up a gallery here on Webby. Being that this site is powered by Wordpress, I thought it would provide a quickie rundown of exactly how I set this up. It is really pretty easy.

After some research, I decided to go with Gallery. This is a free, open source (like Wordpress itself) PHP-powered image gallery. And it is quite powerful. In the past, I had used Photopost for some projects. Photopost is not free and Gallery competes with it easily. The only thing that is lacking (although I didn’t research it heavily so it may be out there) is vBulletin integration, which Photopost accomplishes easily. I downloaded and installed Gallery. I recommend downloading the FULL version because it comes with all the compatible modules (more on this below). The installation process is very user-friendly and their installation script totally walks you through it. Next, I wanted to find a way to easily integrate Gallery into Wordpress, mainly to share the same theme without me having to re-do everything in Gallery separately. I found WPG2, a plug-in for Wordpress which integrates it with Gallery 2.x. I un-zipped the plug-in and installed the files into the appropriate folders. You don’t just upload it all to the plug-ins folder as you usually do. There are other components to be uploaded into other directories, such as the Wordpress root. Once installed, the plug-in does a good job of validating that everything is there that is needed. In my case, I had to make some corrections:

  • Gallery comes with a file called embed.php. This file needs to be uploaded into the Wordpress root, along with the plug-in’s wp-gallery2.php file.
  • You will need to install the Image Block, ImageFrame and URL Rewriting modules into Gallery. Now, this is why I recommend to download the FULL version of Gallery. I originally downloaded a more stripped-down version thinking I don’t need everything. But, I downloaded the 2.1 release of Gallery, whereas the current version is 2.2 so all the modules are for 2.2. When I uploaded the modules, I got errors in Gallery saying the modules were not compatible. So, I finally figured out that I could download the FULL install of 2.1 and then get all the compatible modules with it. That being done, installing the module is as simple as uploading the module’s folder into the “modules” folder of Gallery, then going to the Modules section of the admin and installing and activating it.
  • As part of the URL rewriting, I had to make the .htaccess file writeable and allow Gallery to write to it. I also had to put an htaccess file into the Wordpress root with some changes to it.

With all this done, I called up wp-gallery2.php on the site and, sure enough, Gallery appeared in all it’s glory inside my Wordpress theme. Only problem was that it didn’t really look right. So, first thing I did was download and installed a theme to Gallery called Wordpress Embedded Theme for Gallery. What this does is gives you a default look for Gallery that is adjusted somewhat to make it more compatible with embedding into a Wordpress theme. Even after installing this, the gallery still didn’t look quite right. So, I created new header and footer files (basically copies of the usual header.php and footer.php for my site’s theme) and called them wpg2header.php and wpg2footer.php. I placed these into my Wordpress theme’s folder and this is a way of giving the gallery an adjusted header and footer. After some fine-tuning, I got it to look right.

And here is the result. A functioning gallery that actually looks like it belongs. To get it going, I created a new album with some select pictures from my recent honeymoon in Italy. So, feel free to have a look.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)