Need a Gallery - Can't Use Database, Would like: simple for novice to update

The Situation[INDENT]So, I am making a website for a school Astronomy & Physics department. it seems to be mainly a poster page to talk about their department.

One thing the client wanted is to have an image gallery wish pictures for their new planetarium, science building, observatory, etc. [/INDENT]

The Snag(s)[INDENT]The big snag is that the school’s security settings has all database functions disabled, so pretty much all the convenient options are out (for the site in general, as well as the gallery). This also presents complications for any sort of site configuration because I can’t really implement any sort of login system (except maybe openID or something similar with Google / Facebook / Yahoo / etc?).

Now, the plan I am looking to fall back on if I have to is to make a proprietary system that looks at all the pictures of a directory, and displays thumbnails for them in a grid layout. Likely I would want to make an accompanying cache folder that actually has the shrunk-version of the pictures (which will have some annoying back and forth checking involved).

To give you an idea, I am not even allowed FTP access. I was given the e-mail of the webmaster, and told to e-mail him a zipped copy when it is ready. [/INDENT]

Needs to be Easy[INDENT]The primary contact (and probable updater for the site) is very much a novice when it comes to computers (but very smart in general, being a physicist). I was hoping just getting pictures into a folder would be good enough.

Don’t Reinvent The Wheel (unless you have to)[INDENT]I would rather avoid all this if possible and implement an existing system of some sort if there is one.

One thought I had was to find some sort of external service (like Picasa or some such) and fetch the image data from there. Or if there was even an existing gallery system that could fetch the remote gallery it would be even better.[/INDENT]

What I Have to Work With[INDENT]As far as I can tell the technologies I have available to me include normal client side (html/css, javascript, etc, of course) and PHP on the server side with “pretty much all the normal functions there.”

As far as my own skills, I come from a more traditional desktop computer science background (C/C++, Java, Visual Basic), and have been moving into web dev (still learning). I know HTML/CSS pretty well, and am quickly becoming competent in PHP. I understand Javascript in principle (it seems to have basically C/C++ syntax) but really haven’t messed with it much. My main exposure has been with picking up the fundamentals of jQuery (which seems almost closer to CSS than Javscript for alot of it as far as I can tell). [/INDENT]

Thanks [INDENT]In any case, any help that can be provided is greatly provided. +1 internets if you read this whole thing. [/INDENT]


Not sure if this will help you or not, but a while back I decided to create a gallery type photo site to share with friends and family ( – most of the albums are restricted to a login, but there are a few that you could view)

It does not have an underlying database, in fact, it uses a nightly job to build json files to use for the display. You can download the source code from

Feel free to just use the source or parts of it, etc to develop your system.

Here is how it works:

  1. You define a picture folder and a metadata folder
    a) The picture folder should only contain folders and your pictures
    b) The metadata folder should be originally empty and needs write permissions by the login that executes a task to build that information
  2. It requires command line execution to setup the first administrator, after that, most other options can be done through the web interface
    a) Only exception to that rule is building the albums and photo metadata, that utilizes a cronjob set to run a specific php script (see readme in the zip file, need to open it with WordPad or Notepad++ due to Unix linebreaks)

Beyond that, there are no other requirements. It uses the GD library to resize the images, and json to store the metadata.

I should also say, that I plan on rewriting this software, as I don’t really care for the dependency on javascript anymore. That was originally a fun challenge but provides all sorts of small problems that I had to keep tweaking till I got it right.

So if you do consider utilizing some of the code, I strongly recommend, not keeping the ajax/javascript dependency.

or just read up on the PHP directory functions and make a simple gallery using that.

  1. [FPHP]Glob[/FPHP] image directory.
  2. [FPHP]Foreach[/FPHP] image
  3. [FPHP]If[/FPHP] Thumb DNE, Create it.
  4. Display thumb, with link to picture.
  5. EndForeach

(Step 3 is the longest step; should take you all of… 5 lines of code? 6 if you include the curly brace at the end of the if as a seperate line)

Just for completeness’ sake, another option might be to use a third party gallery plugin like SlideshowPro. I haven’t used it, but a few people I know rave about it.

Send him a .htaccess file relocating it to a domain which you have complete control over.

School admins are generally clueless about security.

I would do as StarLion said but would resize on upload to two different sizes. You can display the thumbs in a div with css float left - one thing I do now is to pad the images so they are all the same size as it makes for a neater layout of the thumbs.

To give you an idea, I am not even allowed FTP access. I was given the e-mail of the webmaster, and told to e-mail him a zipped copy when it is ready.

This sounds as though it could be a pain!

There are loads of of image gallery codes around althogh a lot are over complicated and you could take a look at hotscripts.

First of all: Thank you for your feedback and patience.

Current plan: So what I am currently looking to do is have an invite-only group on Flickr. This group would have a shared gallery that all members can contribute using. Then I embed a gallery that grabs the pictures from that group and displays them on the page.

I went with this because I could also combine it with Yahoo Groups (Yahoo also owns Flickr, and thus they could use the same account). I also needed a convenient way for him to make updates in a news feed. Yahoo groups allows multiple users to post to the same discussion. What I have planned is to make that group invite-only, and only moderators can post. So, our department members get added as moderators of that group. Incidentally that group gets an RSS feed. I then embed that RSS feed onto the page. And now anyone who is a moderator can post news updates for the department.

I also needed a calendar, and Yahoo Groups has a convenient shared calendar too.

So, what I effectively ended up doing was borrowing Yahoo’s databases, since I didn’t have one available.

Does this seem like a sensible solution considering the limitations?

The Flickr idea is a winner, believe me. I used it on a town website.

I got one CMS user to register a Pro Flickr a/c – $25 pa, but they had it free with their Yahoo email account in any case.

So, now they store all their images on Flickr accounts, and I used the Flickr API to integrate the images into their website, that was pretty trivial.

What was not so trivial was integrating the Flickr API into their CMS backend, but its do-able and works.

Thus they can create an Article, and associate it with one of their images, an image from their Group (see below) OR any CC image on Flickr.

That was the basic idea, and it has worked fine for a couple of years.

The are hidden bonuses too:

I created a Flickr Group about their town, and we invited a few known local photographers to add images to that group with the very clear warning that in doing so we would be entitled to use their images on our website (website only) but that we would:

give them full accreditation
link back to the Flickr image

I got the CMS users to add all their images to the Group too.

Then I did more or less nothing. Two years later there are over 40 contributors to the Group and over 1000 really nice images in there - there are still only 2 CMS users.

The 2 CMS users are the moderators of the group, and they can just pick their own images if they want to, but generally the output of images from the local photographers is far better.

I don’t lose any bandwidth or CPUs in image handling or resizing.

We can suck up from Flickr various slide shows, thumbnail groups etc, we can set sub-groups for say a local event and display just those images as a slide show all this stuff would take so much time to code up and organise and train users for.

I don’t have to design GUIs to handle resizing, cropping and all that stuff. Flickr does it all so well, why reinvent the wheel?

This is the PHP API wrapper I used PHPFlickr but I dare say there are others now which do similar.

The only potential problem is that a Flickr Account belongs to a person, and if that person leaves the organisation they represent, then potentially all the images go with them - unless they are transferred out to another account.