HTML Question: indices

Hi guys, I’m uploading pictures to my website (hosted by NYU) and I’m trying to find an easy way to display them. I’ve had some photo gallery software recommended to me, but I don’t need anything that sophisticated–I’m just looking for an easy way through HTML (or an html editor) that will allow me to make an .html file that just lists all the photos in a directory and provides links to the images. Thumbnails would be nice but by no means necessary.

Any tips?

I’ve not used thumbnails, but it seems like you could just set up a page with a list of the names/descriptions of the images, with a link in each line item to the specific images.

I’d do it as an unordered list:

Within your <body> tag, use:

<ul>
<li><a href=“whateveryourfilenameis.whatever”>Name</a> Description of image
<li>Same thing, different file name
</ul>

If you have thumbnails, that can be included in the link: <a href=“filename”><img src=“thumbnail”></a>

But that’s how I’d look at it - make it as simple as possible, because that makes it easy to go in and change.
Though there could well be a better way to do it that I’m not thinking of.

Lsura, appreciate the help…maybe a little more description would be useful.

I’ve got about 200 pictures to post, and I don’t need or want to name them all. I’m looking for something that will basically just display the contents of a web folder, with links to those documents.

What you’ve described, strictly speaking, can be done by simply linking the URL of the directory containing the file.

What you get is a list of file names.

If you run your own server, or have an extremely versatile domain hosting service [1], you can configure Apache to actually display a thumbnail of the graphic, instead of theusual ‘graphic’ icon. Be aware, however, that is costs a LOT of CPU time, compared to normal webserving, because the server might have to generate new thumbnails on the fly each time the directory is loaded. [It’s been a long time since I played with this technique, so I don’t recall the various settings [which have undoubtedly grown since]. Today, there may be an option to save thumbnails once they’ve been created.

A compromise is to use a script like index.cgi which generates and saves thumbnails (etc.) whenever you run the script with the right arguments. You’d only do this once, whenever you added pictures. When the script is accessed without the arguments, the server serves the pre-created thumbnails. [the privileges are set so that an outside viewer can’t access the edit functions, etc.]

There are many other scripts that will perform this functions. Some are probably more sophisticated and feature-filled. Not all hosts let you run CGI scripts (or only let you run the ones they have already vetted and installed)

So to summarize:

  1. link the directory for a clickable list of filenames

  2. if you have sufficient control, you can thumbnail the above

  3. a CGI script can do all the above, with less CPU drain.

  4. <The hosting service I use [BSDwebhosting.NET - beware the .com squatter] runs a separate instance [copy] of Apache for each domain; I can completely reconfigure even the most fundamental settings of my domain’s virtual server, without any effect on the other virtual servers running other domains on the same physical machine. (Think of the way you can run MS-Word from a server, and only affect your documents, not other documents that other users in the company may be using at that moment: they are using another virtual instance of the same program) It’s also dead cheap. Some of my least used domains run under a quarter a month! However, since it gives you so much power over your configuration, BSDwebhosting.net won’r give you essentially any tech support. If you get enough rope to hang yourself, you can’t expect someone else to unhang you - unless you hire an expert consultant.>

If you want to be brutally simple, just link to the directory name the pictures live in, relative to the doc root (a link to one of the pictures, with the actual file name removed). If there is no file named something like “index.html” in that directory, most webservers will simply list the directory with a link for each file. Of course, you won’t have any control over the formatting, which will be pretty ugly.

If you want something more, and you do not wish to hand code html with each name you need to either:

1 - dynamically generate the page on request (requires that your host allows you to do CGI scripts or provides some kind of application server / other server side scripting support).

2 - run something that generates the static html, and will be rerun everytime you change the contents.

The complexity of the logic involved will increase with how sophisticated you want to be. This is why there are prepackaged things like the photo gallery software you mentioned.

If you have any knowledge of shell scripting, a simple CGI script or a shell script command to do 2, should be something you could do.

OK, KP wins the simulpost race by 2 minutes.

Sorry guys, I left this part out:

For some reason, I can’t allow people to view the directory on its own.

http://homepages.nyu.edu/~epr203/costumes

The weird thing is that the directory is set to allow all people to read it. But it still doesn’t allow it. It may be NYU’s way of stopping illegal file-sharing or something like that.

If you mean that you set the OS directory permissions to allow access, that doesn’t apply here. You might try creating an .htaccess file for that directory if that isn’t what you’ve done already. You might also talk to your hosting service, and see what they want you to do to permit access. They probably think they are doing you a service, since people usually DON’T want users able to view directory listings of their site, and often forget to prevent it.

I haven’t tried to mess with .htaccess files for a while, so I can’t give you explicit instructions off the top of my head.