Making my own photo gallery. Separate pic folders or just one?

I’m building my own photo gallery for my website, and my initial plan was to have the following folder structure:

/gallery/ (for the main pics, around 600px wide)
/gallery/fullsize/ (for the original, around 1280px wide)
/gallery/thumbnails/ (for the 150px wide thumbnails)

They will be organized in a database.

I have most of it working now, and am working on the layout for the main gallery page, BUT when I went to download all the pics from my old photo gallery (which was a Gallery2 install), I noticed that each album has its own folder. Now I’m second-guessing my album design.

What are the advantages of creating separate folders for the different albums? Is it work modifying my gallery to create subfolders?

I don’t see any real reason for various folders. You can easily distinguish the various versions of each file by the name. But it’s up to you, really, If you find it useful to organize files this way, then go for it; but if it’s more work, with no obvious advantage, I wouldn’t bother.

There is no advantage. One folder

I have to agree with Ralph. I’d go with one folder, go with your original plan. :slight_smile:

Thanks for the input. I guess the only real advantage I can think of is “friendly” URLs without having to figure out a bunch of mod rewrite rules. To me, /gallery/vacations/2009/ looks better than /gallery/index.cfm?album=12. Plus, I’m not how to do mod rewrites if some albums have /album_name/pic and other have /album_name/sub_album/pic.

I guess it depends on how you are setting up the gallery. I wasn’t thinking in terms of URLs. I’m not sure why anyone would ever see URLs like that. I think of a gallery as a series of pictures on a page (perhaps enhanced with JS) but I don’t see why or where someone would need to see a URL like that. Where you store your images is different from where you post your gallery page.

I could be over-thinking this.

When I had Gallery 2 installed on my old website, it has these long, hideous URLs for pics (i.e. /gallery/index.php?g2_itemId=20130). This would be very easy to do of course, because you just call the ID number of the row. But they had an option that you could click in the admin panel to turn that URL into /gallery/vacations/holland/20130, and I thought it made the URL look a lot better, especially if you had to paste the link into an email or something.

In my database, I’ve added a “url” to my albums table. It’s basically an all lowercase, no-spaces identifier (i.e. “vacations”) that I could use in the URL, but I’ve always been told it’s way better to use numbers. But if I do some mod rewrite tricks, it would be easier to use that identifier than a number.

But maybe no one really looks at the URL and I’m wasting a bunch of effort. But I see what you mean about how I store my pics vs how I display them on my gallery page.

Just as a follow-up, I went with Eric and Ralph’s suggestion of doing one folder (rather than a folder for each album) and it’s worked out beautifully. The code is much simpler, and I just found an unexpected advantage when I had to move a top-level album within another album (making it a child of that album). It was a simple matter of changing the parent_album from null to the ID of the new parent. Took 2 seconds.

Thanks for the recommendations. The new gallery was a bit of work, but it works fantastically. However with 4272 photos (triple that if you count the thumbnails and fullsize versions) I think I’ll be waiting a week for my 15/5 fibre service to be installed. Uploading those pics over my current 0.67mb upload speed (on a good day) is a bit much to ask. :shifty:

Thanks for the feedback! You are fortunate that you can get upload/download speeds like that. :slight_smile:

Well now I have a follow-up question, but it’s more of an HTML/usability question than a programming question, but I don’t know if there’s a better place to ask it, so I’ll just keep this going.

So now my photo gallery is up, and I have added previous/next navigation. I’ve also changed my right column into a scrolling column of thumbnails, so you can scroll through them while looking at a single pic, and click one to go straight to it.

I want the list to scroll as the photos advance, so I’ve put named anchors with each thumbnail, and that makes the list scroll to the current pic. It also has the side-effect of scrolling the page down so that the current pic is right about where I want it.

It works great until you get to the last few pics, at which point the page scrolls up, putting the current pic off the top edge of the screen, so a user has to scroll back down to see it.

Example here. If you click “next” (or just click the main pic) you’ll go through the gallery, and you can see what happens when you get to the end.

So the question is, is there a better way to get that column of thumbnail on the right to scroll to keep the thumbnail of the currently being viewed pic at the top? Or at least on the page.

I found a jquery plugin called ScrollTo that I’m going to fiddle with.

Why reinvent the wheel? Go to and download a free one then modify it to suit your needs.

When I did this I put all the gallery photos in in folder and named them like this…


Then I put all the controls images in a separate folder. The arrows shadows and such. But since that can all be done worth css now there is no need.

Because it will take me twice as long to integrate the free one into my existing website then it would to write one myself. Then when the next version of the free one comes out, I have to do it all again. And when I want the free one to do something it doesn’t do out of the box, it takes even more fiddling and posts on support forums that go unanswered. Been there, done that.

My gallery is done and the bulk of it took me two weekend, working mornings and evenings. Probably 20 hrs max. It does everything I want it to do, exactly the way I want to do it, and if I need to add a feature, it takes a few minutes because I know every nut and bolt of it. It’s not stuffed with extra things I’ll never use, it’s speedy, and it was fun to write.

Why reinvent the wheel? Because the old one was square. :slight_smile:

Fair enough! :slight_smile: