How to setup a shared photo hub using Gallery on your hosted space.

Written by Tyler Jacobson on November 28, 2012

I recently went to a wedding in Athens, GA for my brother-in-law. The wedding was held at an amazing location, a massive tin factory converted into an artists studio with large scale statues everywhere. Not only was the location something awe inspiring, but the bride and groom also hired a mobile petting zoo with goats and rabbits whose heads were bigger than mine. On top of all of this, a wedding was occurring. Needless to say, there were many pictures taken by friends and family who were both near and far.

So, how can we all share our pictures, with relative ease and also not having to worry about who owns the pictures once they are uploaded? What follows is my step by step walkthrough to answering to these issues.

Installation

Photo sharing. I know there are services that cover that need, but as they say of social networking, if you’re not paying for the service, then you’re the product rather than the customer. For that reason, the first thing I did was establish hosting for my brother-in-law and his new bride. I wanted the site to be private and owned by them.

Next, I installed Gallery. Because Gallery provides the entirety of the content to the site I installed it directly into the public_html directory. The image gallery would be the first, and only, thing that a visitor sees.

Appearance

I then logged into Gallery as the Admin to ever so slightly customize the look. I downloaded the Clean Canvas Theme from the gallery codex. What I was going for, above all else, was an unintimidating simple look for the site. I also wanted to find a main color for the site that wasn’t too severe or gloomy. The Clean Canvas theme fit that bill nicely.

With the theme installed, I decided to replace the default logo with a custom logo. I’m sure there are more than a couple of ways to do this, but I chose to use the most expedient way for me. I control+clicked the logo in my web browser and selected “Open Image in New Tab…” from the pop up menu. This gave me 2 pieces of information I would need:

1) The full path to the image I was going to replace (http://the-site-name.com/themes/clean_canvas/images/canvaslogo.png)

2) in the title of the tab that showed the image, it gave me the image dimension in pixels (128×44).

I fired up my preferred image editor (if you don’t have one, start with the free Gimp program) and created a new image with those dimensions. Once complete, I saved it as a PNG file with the name ‘canvaslogo.png’. With the save complete, I logged into the site’s server space via FTP replaced the file of the same name on the server.

Functionality

Now that the site looked the way I wanted I had to worry about it acting the way I wanted.

While logged in as the admin, I went to the front page of my site to view my (currently empty) gallery. From there, I clicked Album Options > Edit permissions. I allowed all visitors to view thumbnails, but only registered users were allowed to also view full size images, edit images and add images. Should a spammer make their way to the site, I wanted to do at least the bare minimum in preventing them from being able to add or edit content.

While under the Album Options menu, I then clicked Edit Album. Here I added a nice Title to the album. I opted to use the Description field to inform visitors on how to use the site (“Register to upload your photos or add comments.”), rather than to elaborate on the title.

Despite my description telling visitors that they were required to register with the site in order to leave comments, that actually wasn’t the case…. yet. In order to set that restriction, I needed to work my way back into the Admin section of the site, click on Settings and then select Comments.

In the Comments settings there is a field asking ‘Who can leave comment?‘. In the drop down menu immediately below I selected “Only registered users.” and clicked Save.

This was all well and good, but I didn’t actually see any place for users to register on the site. There’s a login link – but nothing to allow for new registers to login. To compensate for that, I installed the Register module, which allows visitors to register on the site.

Lastly, what fun is sharing photos if you can’t easily share them to your social network? For that reason I installed the Facebook Like module which offers Facebook sharing options for each individual photo.

Security

While I was in the Admin > Modules section, I also activated the pre-installed reCaptcha module. I highly recommend fully activating the reCaptcha to keep spam-bots at bay. This module will require those people registering for your site to read and type in a couple of visually distorted words.

I had assumed that most people would find out about this site through word of mouth, with the bride and groom helping to inform their guests of the site. Because of that, I figured that ¬†inclusion in a search engine would be more harmful than helpful. I didn’t want the photos indexed in Google and I didn’t want this Gallery site indexed so that it could be a made a target by malicious hackers. For this reason, I added a robots.txt file in the public_html directory with these lines:

User-agent: *
Disallow: /

This tells all search engine to disallow indexing of the entire site.

Finishing Touches

With some security in place and permissions set to allow registered users to upload their photos, we were off. I uploaded my photos. My sister-in-law’s sister upload some of hers and someone else entirely uploaded photos. But, I was a bit annoyed because the front page remained stagnant, only showing my initial uploads. I wanted to reverse the sort order to show the newest uploads, rather than oldest.

To rectify this, from the front page of the Gallery, I again selected Album options > Edit album. Near the bottom of the Edit Album page I changed the Order from Ascending to Descending. Upon clicking modify, the most recently uploaded images showed on the front page.