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

Stand alone image manager restrict image upload size

3 Answers 44 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Cheri Verdend
Top achievements
Rank 1
Cheri Verdend asked on 23 Jul 2012, 09:32 PM
I've followed the KB article to create a stand alone image manager which allows my users to select an existing image, or upload a new one. Now I need to restrict the images being uploaded to a specific height and width. I've found a couple threads on how to accomplish that with an image manager inside a radEditor. But I can't seem to translate the steps to work for a stand alone Image manager. Any help would be greatly appreciated!

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 25 Jul 2012, 03:50 PM
Hi,

You can specify the desired upload file size for the Image Manager using the following code:

FileManagerDialogParameters imageManagerParameters = new FileManagerDialogParameters();
imageManagerParameters.ViewPaths = new string[] { "~/Images" };
imageManagerParameters.UploadPaths = new string[] { "~/Images" };
imageManagerParameters.DeletePaths = new string[] { "~/Images" };
imageManagerParameters.MaxUploadFileSize = 15000000;

The MaxUploadFileSize property is set in the example demonstrated in this KB article: http://www.telerik.com/support/kb/aspnet-ajax/editor/using-the-image-and-document-managers-outside-radeditor.aspx

Kind regards,
Rumen
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.
0
Cheri Verdend
Top achievements
Rank 1
answered on 25 Jul 2012, 04:43 PM
Rumen, I appreciate the reply. But I need to restrict the image height and width, not the file size. Is ther a way to do that? Cheri
0
Rumen
Telerik team
answered on 30 Jul 2012, 12:07 PM
Hi,

You can see how to resize an image using the StoreFile function of the FileSystemContentProvider of the ImageManager in the following forum thread: RadEditor restricting image width and height.

Here is how to attach a custom provider to the standalone dialog:

FileManagerDialogParameters imageManagerParameters = new FileManagerDialogParameters();
imageManagerParameters.FileBrowserContentProviderTypeName = typeof(myprovider).AssemblyQualifiedName;


Best regards,
Rumen
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.
Tags
Editor
Asked by
Cheri Verdend
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Cheri Verdend
Top achievements
Rank 1
Share this question
or