Working with Image Thumbnails in AJAX File Browser
How Images Preview are Requested
The Ajax File Browser provides several modes in which it displays image thumbnails.
There is no need in generating thumbnails on server side to display a resized image. The AJAX File Browser and user agent correctly process and resize images of any size on a client side.
However if you would like to minimize bandwidth, your server can generate necessary thumbnail and return it instead of original image. When requesting an image thumbnail the AJAX File Browser adds width and height arguments to query string:
http://webdavserver.com/image.gif?width=42&height=42

The AJAX File Browser displays images of the following size: 42x42px, 85x85px, 232x232px. To programmatically set view mode call SetViewMode passing necessary view mode:
ajaxFileBrowser.SetViewMode(ITHit.WebDAV.Client.AjaxFileBrowser.Render.ViewModes.Large);
The ViewModes enum can have following values: Details, Medium, Large, ExtraLarge. To get the view mode call GetViewMode method.
How to Turn-off Image Preview
To display an icon instead of thumbnail call SetShowImagePreview method and pass false as an argument:
ajaxFileBrowser.SetShowImagePreview(false); ajaxFileBrowser.Refresh();
To read the this setting use GetShowImagePreview method. To redraw the view call Refresh method.
Setting List of File Extensions for Image Preview
To set the list of file types for which AJAX File Browser will request and generate image previews call SetImageTypes method and pass string containing list of file extensions separated by '|' symbol:
ajaxFileBrowser.SetImageTypes('png|jpg|jpeg|gif');
To read the list of file types use GetImageTypes method. By default AJAX File Browser generates thumbnails for png, jpg, jpeg, gif, bmp and tiff images. For all files that are not included in the list returned by GetImageTypes, file icons are displayed. The file icons are stored in subfolders of icons\ folder in png format. You can add more icons to this folders or delete unnecessary icons. If no appropriate icon is found the default file icon is displayed.
AJAX File Browser Control Image Preview Demo
|