杂七杂八 项目、研究

Image Thumbnail Proxy

By @sskaje

A friend of mine asked me how to check if a file exists remotely (http 404) so that he can create thumbnail for images which don’t have a thumbnail of that size.

As what he planned to do, a visitor browse his page, his script will check all images ready for rendering have a suitable thumbnail.

Checking a HTTP 404 is quite easy, but it’s not wise checking on page’s loading, if there are n images to be checked, a single page visit would makes server requests n to 2*n times for checking/generating thumbnail. These requests are useless at most time.

Image Thumbnail Proxy by @sskaje: