I'm using a simple method to display 'avatars' on my page. Rather than uploading a users picture, I simply use the URL they provide. To make sure the link is a picture I check from the right and up to the first '.' encountered. If I get 'jpg/jpeg/bmp/png/gif' returned then the link is a picture.

However what I would also like to do is, if the link no longer exists or cannot be found, show a generic picture.

Any ideas on how to do this bit?