Fast Thumbnail Server is a standalone application that helps you to serve thumbnails of the images of in your web site by separate a sub-domain or an other domain. This is the simplest and fastest way to serve images.
The application simply creates the thumbnail at the first call and serves the thumbnails statically at the later calls. This improves your server performance as it does not need PHP executions and image processing at the later calls.
Fast Thumbnail Server uses 404 error handling directive of the web-servers to manage the thumbnail creation of the images. When a browser first request an thumbnail, as it does not exists in the system, the web server redirects the request to 404 page (e404.php should be configured as 404 page). 404 page creates the thumbnail and saves the thumbnail to directory specified in the URL of the request. At later requests of the thumbnail, the thumbnail is served statically from the directory. The later calls does not cause PHP executions.
There are many advantages of having a separate image server in your web sites;
- Many browsers will only allocate two sockets to downloading assets from a single host. If you serve images with the same domain of your site images and other contents uses these two sockets. But If you serve images with a sub-domain or other domain, you get an extra two sockets dedicated to download your images.
- With a different domain your server not send the cookies data with every request as the images will be served statically after the first call.
- Using a different domain or sub-domain isolates the functionalities in your application and makes easier to make load balancing in your application.
Existing Resize Modes
Fast Thumbnail Server has 4 resize modes and 1 crop mode. 1,2,3 and 4 is used for resizng and 5 is used for croping.
- Mode 1: Resize the images to given dimensions but if the ratio of the given dimension is not the same as the original image (given_width/given_height is not equal to original_width/original_height), white margins will be added to thumbnail to preserve the proportion. If you want to create a thumbnail with dimensions 50X40 from an original image with dimensions 200X200, the thumbnail is created such that it has 5 pixel white margins from right and left.
- Mode 2: The image is resized by fixing the given width. If you want to create a thumbnail with dimensions 50X40 from an original image with dimensions 200X200, the thumbnail is with dimensions 50X50.
- Mode 3: The image is resized by fixing the given height. If you want to create a thumbnail with dimensions 50X40 from an original image with dimensions 200X200, the thumbnail is with dimensions 40X40.
- Mode 4: The image is resized by streching the image to the given dimensions. If you want to create a thumbnail with dimensions 50X40 from an original image with dimensions 200X200, the thumbnail is with dimensions 50X40 and the image is streched. This mode has transparency support for PNG files.
- Mode 5: The image is croped to given dimensions from top left corner by default. You can give custom crop starting point by adding information by the mask “-left_top”.
You have “image.png” in your image folder. You have set up Fast Image Server as a subdomain such as images.yourdomain.com.
- <img src=”http://images.yourdomain.com/1/120×120/image.png” />
The thumbnail image is created at the first call and at later calls the image is served statically which is the fastest way to serve static content
- <img src=”http://images.yourdomain.com/2/200×200/image.png” />
Another thumbnail with resize mode 2
- <img src=”http://images.yourdomain.com/5/200×200/image.png” />
Another thumbnail which is a 200×200 cropped image
- <img src=”http://images.yourdomain.com/1/[original_w]x[original_h]/image.png” />
You can give original dimensions to serve original image
- Watermark Support
- Config test page
- Multiple directory structure for original files
- Paranoid security mode