in reply to reading all images in a directory

Before you go off and design a page which builds up a fixed row/column scheme for images, please consider doing it with a free-flowing approach, with CSS. An example is my "Quick Pix" image gallery. I didn't invent the CSS methods to do it, but the code and the markup is pretty straightforward.

Stretch the page's width and watch it lay out different numbers of columns. Unless you REALLY need something to be tabular, try to avoid <table>...</table> markup.

As for the thumbnails, you should also probably do that work once, instead of having the web server do that work thousands of times. I do it on my local machine, as a part of the process of uploading the images. I don't expect my web server to do any real work beyond delivering bits.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^2: reading all images in a directory
by waswas-fng (Curate) on Jun 24, 2005 at 18:00 UTC
    The do thumbnail at loading suggestion is great -- it may seem like a small task to generate the thumbnails dynamically but it always turns out that it is the straw that breaks the camels back when the site gets busy. The two ways I do it (they have different advantages and weaknesses) are: 1: as images are uploaded generate the thumbnails needed (usually in my case a few different sizes for different views). 2: Allow uploads to happen without creating thumbnails, but on first access to each type of thumbnail generate and cache it.

    The first way works better when the addition of images to a site are controlled only by your app -- such as with a cgi form. The second works well when users can place images in a directory structure or in some other way to insert into the site without your app knowing about them.


    -Waswas