This is a migrated thread and some comments may be shown as answers.

Resizing an image before the FileUpload uploads the file to the server

2 Answers 90 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 11 Aug 2008, 06:30 PM
I am new to the Telerik world and I am enjoying using the controls that I have implemented thus far.  The control I am working with is the ImageManager as a standalone control outside of the RadEditor.  Does anyone know if there is any functionality that will allow me to resize an image before the FileUpload saves the file?  After resizing the image, the image would be on some preview page before anything is committed to the server.  

Thanks,

Ron

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 12 Aug 2008, 11:37 AM
Hi Ron,

There is no specific event when an upload finishes. However, what you can do is override the default file system provider and execute your check whenever a file is saved. For example:

public class CustomProvider : Telerik.Web.UI.Widgets.FileSystemContentProvider  
{  
    public CustomProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)  
        : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)  
    {  
    }  
    public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments)  
    {  
        //custom code goes here  
        return base.StoreFile(file, path, name, arguments);  
    }  

When you add the dialog definitions for the image manager and image editor, you need to select the new provider:

...  
ImageManagerDialogParameters dialogParameters = new ImageManagerDialogParameters();  
dialogParameters.FileBrowserContentProviderTypeName = typeof(CustomProvider).AssemblyQualifiedName;  
... 

You can find more information here.

All the best,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ron
Top achievements
Rank 1
answered on 12 Aug 2008, 01:51 PM
Rumen.  

That is exactly what I need.

Thanks a bunch!

Ron
Tags
Editor
Asked by
Ron
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ron
Top achievements
Rank 1
Share this question
or