Replacing thumbnail functionality

3 posts, 0 answers
  1. Balint
    Balint avatar
    2 posts
    Member since:
    Aug 2012

    Posted 24 Aug 2012 Link to this post

    Hello guys,

    Really love the FileExplorer, but I'd like to tinker with the Thumbnails functionality. In its current state the thumbnail is just a link to the original image. Since I use the FileExplorer control to serve up a gallery of hi-res stock images, my page basically downloads twenty-megabyte JPEGs as "thumbnails". This also results in ugly compression artifacts and distortions as the browser uses its own algorithm to compress the image.

    Is there any way to override the thumbnail display functionality either on the client side or on the server side? For example, if I could point the thumbnails to an ASP.NET handler instead of the images themselves I'd be all set to go since I could perform my own high-quality resizing on the server side and serve up small, good quality thumbnails.

    Any ideas?
  2. Vessy
    Vessy avatar
    2134 posts

    Posted 29 Aug 2012 Link to this post

    Hi Balint,

    In order to achieve the desired functionality you should implement a custom FileBrowserContentProvider. Then you have to change the behavior of the ResolveDirectory method as the easiest way to do this is to subclass the default provider (Telerik.Web.UI.Widgets.FileSystemContentProvider)  and override that method only.

    For example, you could use your own compression algorithm  in order to create the thumbnails and then to set the file's URL to the desired thumbnail in the overwritten method. The specific thing here is that the default content provider does not set URLs and when you implement it every image will be a link to its thumbnail but not to itself.

    This could be workarounded with the following handler, attached to the OnClientFileOpen event, which will bring back the original paths to the images:
    <telerik:RadFileExplorer ID="FileExplorer1" runat="server" OnClientFileOpen="explorerFileOpen">
        <Configuration ViewPaths="~/Images" UploadPaths="~/Images" />
    <script type="text/javascript">
        function explorerFileOpen(explorer, args) {

    Following a similar logic, you could also overwrite the StoreFile method, associating a thumbnail to every new image which is being uploaded.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Balint
    Balint avatar
    2 posts
    Member since:
    Aug 2012

    Posted 10 Sep 2012 Link to this post

    Thanks Veselina, this did the trick!
Back to Top