This evening, I was thinking about a conundrum. I had just been talking with my grandmother about sharing her photo collection out to the rest of our family. While my first thought revolved around A) using Dropbox to sync files down to her laptop while she travels, I realized that that was one level of complexity too high. Why add the need for travel? Better to set it up so that anyone can access it from anywhere.
So, how to do this? Set up a hosted site to upload pictures to with an application like Coppermine Photo Gallery powering the backend? This was a big thought in my mind because it’d be very easy to navigate for the end user, and it would have system-side authentication built in. Plus, I could even host it on my webhosting! I eventually decided against this, but not for lack of utility – more because it would add a step. First my grandmother would have to put the photos on her computer, then process the files using her photo software to sort them into her filing structure, then finally upload them to the website.
I moved on from that idea to try to figure out how to just make the photos immediately accessible. I wanted her to be able to just use the same process she’d always used, but to be able to have new photos get shared out immediately with no additional work. I wanted to make sure that her computer stayed secure as well, though. I looked into IIS, but quickly discovered that not only would it be a pain to try and make it work with Windows XP, it wasn’t even supported on XP Home! I decided to go back to my roots.
Back when I first started getting back into computers (think grade 7 or 8 when I really started to get going), I had loaded upApache 1.1 on my Windows XP computer and was experimenting with hosting a site off of my own computer using a dynamic DNS client. The dream back then died quickly because I didn’t know enough about how to configure Apache, but after working withLAMP servers at Student Affairs IT for two years, I got pretty good at working with httpd.conf. My experience continued to grow when I worked on a couple possible projects atMainstreethost (specifically a couple different ways to stream media – either via MediaTomb UPnP streaming or via Icecastinternet radio), but after using IIS in a production environment I fell in love with it and kind of forgot about Apache.
Thing is, though, it really fit my needs for this project.
It’s simple to use, it installs on any computer you’d like it to, and it just works (well, as long as you know how to work with it and edit the .conf files appropriately). Coupled with appropriate port forwarding and a good dynamic DNS client (I used NoIP for this project), it makes a lot of sense to use it.
Let me take a step back and actually explain what Apache is, though. I try to make this blog accessible to everyone, so might as well, right?
Apache is an HTTP server software. What that means is that it serves out webpages from the computer it’s installed on. For example, this page – the one you’re viewing now – is running off of a computer with some form of webserver software installed. (Apache, IIS, and nginx are all examples of this – but don’t think too much about which one’s which, just remember what they do). In Apache’s case, it’s largely configured using a specific file which you can edit to set anything from where the website is stored on the computer to who can access each individual directory.
To go a little deeper into the control part of this whole thing, Apache reads files inside the website called “.htaccess” and “.htpasswd” to determine who can access the website, what pages can be accessed, what to do if a page doesn’t exist, stuff like that. They use specific syntax to create rules to make the website do what it needs to do.
Anyway, I loaded it up, pointed it to the directory where all the pictures hung out, put together access rules, and created .htaccess and .htpasswd files (I really recommend htaccesstoolsfor this – especially on a Windows box!) – and then restarted the Apache service. Sure enough, navigating to the web address that I registered took me to a login prompt. Typed in the credentials I set – and sure enough…
In this case, things behaved themselves! Obviously, I still have to style it (I’m thinking a procedurally generated list iterating through every directory and image in the folder using PHP and returning as links which also have classes that will be styled with thumbnails and stuff), but it’s really looking good!
Granted, this means that I have to get a Raspberry Pi (My birthday’s coming up – maybe I should make it a present for myself? One of the Model B’s plus this case would look really awesome), but I think this seems like a fun, useful project. I could set it up to stream video to my second monitor, which I could use like a TV or something…Seems like a very cool thing.
Any thoughts on fun IT projects I could take on next? Leave your thoughts in the comments below!