9 Answers, 1 is accepted
1) The method that you will need is saveImageOnServer(fileName, overwrite) - http://www.telerik.com/help/aspnet-ajax/radimageeditor-client-side-api.html.
//saves the image on the server - it either overwrites the file or keeps both files
You can see how to implement a custom Save button in the following forum thread: http://www.telerik.com/community/forums/aspnet-ajax/image-editor/future-development.aspx.
the Telerik team
You can use the OnImageSaving server event of RadImageEditor to copy the image in the desired location.
the Telerik team
I get the following error:
System.MissingMemberException was unhandled by user code
Message=Public member 'saveImageOnServer' on type 'RadImageEditor' not found.
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.CallMethod(Container BaseReference, String MethodName, Object Arguments, String ArgumentNames, Type TypeArguments, Boolean CopyBack, BindingFlags InvocationFlags, Boolean ReportErrors, ResolutionFailure& Failure)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object Arguments, String ArgumentNames, Type TypeArguments, Boolean CopyBack, Boolean IgnoreReturn)
at AdminOffice_PhotoUpload.OCSImageEditor_ImageSaving(Object sender, ImageEditorSavingEventArgs args) in C:\Users\Art\Documents\Visual Studio 2010\WebSites\Oglethorpe\AdminOffice\PhotoUpload.aspx.vb:line 34
at Telerik.Web.UI.RadImageEditor.RaiseImageSavingEvent(ImageEditorSavingEventArgs savingEventArgs, Object eventKey)
at Telerik.Web.UI.RadImageEditor.OnImageSaving(ImageEditorSavingEventArgs savingEventArgs)
at Telerik.Web.UI.RadImageEditor.SaveEditableImage(EditableImage editableImage, ICacheImageProvider provider, String imageName, Boolean overwrite)
at Telerik.Web.UI.RadImageEditor.ApplyServerOperation(Dictionary`2 data)
at Telerik.Web.UI.RadImageEditor.LoadImageCallback(Object sender, RadXmlHttpPanelEventArgs e)
saveImageOnServeris a client-side method and you cannot call it on the server:
If you want to save the modified image in another location see this forum thread:
All the best,
the Telerik team
So here is what I do:
- User click on their existing picture or blank pic placeholder
- I launch image editor in radwindow
- Now they can edit their pic, or upload a new and edit it.
- I on purpose left the save button from the toolbar, and added my own button that call RadImageEditor1_ImageSaving
- I only allow jpegs an also optimize and resize the image (I have 2000+ memners on the site and can;t afford each of them having a 1 - 2mb profile pic (you know regular non IT people, they just upload from their camera 12Mpixel photos)
(Still have to add the closing of the window, and default / existing image in the markup... and some other obvious parts not shown)
I see there is not needed lines above..... the proportional resize and optimize code was copy-pasted from another project where I worked with transparent png, and now I just allow jpg, so lines like gr.Clear(Color.Transparent); can obviously be removed as I work with jpg here.
But, its very effective, high quality compression (non of any test photos ever greater than 12Kb) using only NET.
Personally, I think telerik supprot staff and the examples can be better example.... What the use of showing a sample event on image saving with code like alert('the swave button was clicked')..... alert('the image was resized')
Second, whats an image editor without compression options !!! Telerik, the image editor in not version 1 anymore, and adding buld in compression is surley not difficult.
Thank you for sharing your solution with our community and for the given feedback.
We are trying to implement both simple and complicated examples, so they can be useful for bigger range of clients - from the ones that have just been introduced to the controls to the ones that are already in the process of implementing a real-life applications (e.g., how to upload an image or to save it to a custom location). Yet the most complex scenarios provided by us, including controls integration, can be found in our Sample applications and the Code library section of our side.
The latter is also the place where each user can upload a developed by himself custom scenario as, unfortunately, we cannot cover all kind of controls integrations in our demos. Furthermore, if you decide to upload your solution to the ImageEditor's Code Libraries and you will be granted with the corresponding amount of Telerik points.
As for the image compression functionality - I cannot help but agree that this would be a great feature for the ImageEditor. I have submitted your suggestion as a feature request into our Feedback portal and you can follow and vote the item here: feedback item. I have also updated you Telerik points as a small sign of gratitude for your involvement.
See What's Next in App Development. Register for TelerikNEXT.