How to Create Your Own File-Based Image Galleries with php, ftp, Shadowbox and a Groovy File Structure

or perhaps titled:

I don’t trust anyone with my photos, not Flickr, not Google and especially not Mark Zuckerberg!

Requirements

  • Linux Hosting Account (php enabled)
  • ftp program for uploading files

Implementation

History
Many years ago, in the dark ages of web development, when I had a Windows hosting account, you know one of those $4.95 a month deals, and I wanted to post lovely photos of my kids and vacations, I would do it a state of the art way. I’d open Photoshop 7 and chose “Create Web Gallery.” I would then wrestle the various dialogue boxes into submission and create a Web Gallery. It worked. It looked cool. It used tables for layouts. I was a genius.

Last year I closed my Windows hosting account. Never use webhost4life. It is a terrible hosting company. As I was doing a lot of Word Press, I chose BlueHost. So far so good.

Now I could have just uploaded all my old Photoshop galleries to my new hosting account but this seemed lame. I did not want to use any Web 2.0 stuff, in other words startup companies just waiting to be bought out and make your life really complicated, but I did want to use ftp to upload files. So with a little php, notably scandir, I created a way to display all the photos in lovely paging galleries.  The first time a particular gallery is accessed, it creates a folder of thumbnails in that directory named ‘thumbs.’ This makes the pages load faster.  Larger versions of the images utilize Michael Jackson shadowbox, still one of my favorite lightboxes  There is no indexing for searching, or meta tags, but to be honest, I would never get around to entering this sort of data. Maybe in the next version, I will add this feature.

A few key elements (let us say features and recommendations) of “Paul’s Amazing php Photo Gallery” are

  • Name your folders like this 2012-08-New York. The folders will display by replacing the dashes with spaces and are ordered in descending order.
  • Process your images to 1200px wide. This way they will look great when large, but not so big it takes forever to see a gallery.
  • All gallery images have a lightbox large image version. Go shadowbox!

that’s it…
Enjoy!