On Wed, Feb 07, 2007 at 11:00:38AM +0900, Jerry Jones wrote:
> I understand that browsers render the page, I could have worded that
> better. What I was meaning was when a request is sent, would it be a
> serious hit on performance to check for the image file, and if not
> present, default to the 'no image available' image.

You mean: when the webserver gets a request for /images/foo.png, and foo.png
does not exist, it returns a default image instead?

Yes this is possible. Under Apache you would use mod_rewrite, using the -f
test to check if a file exists.

> Or would it be
> best to have an index of the image file names and when a request is
> sent to the server, it checks the index, and if the image file is not
> listed, default to the 'no image available' image.

I think you are talking about testing the existence of a file in the
filesystem, versus testing the existence of a key in a hash. The hash lookup
will be a bit faster, but I don't think you'll see much difference in
practice; if lots of clients are accessing non-existent files, then the
directory will be cached by the O/S anyway.

> At the moment, I am running Webrick.

Then I guess you can serve /images/ from a small piece of Ruby which
implements either of the above strategies.

> I am trying to get IIS to work with RoR.

No idea how you would do this with IIS, apart from continuing to map
/images/* to a piece of Ruby.