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

ImageSaving

1 Answer 86 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 24 May 2012, 09:17 AM
I click on the save button in the toolbar. Select in the dialog Save Image to server. I save the image to database using the code below, but it even create a image file to the folder.
How do I get around the problem that it creates an image in the folder when I save? Just want the image changes are saved to the database when I choose "Save Image to server". Someone who can help me :-)
Protected Sub RadImageEditor1_ImageSaving(sender As Object, args As ImageEditorSavingEventArgs)
 
    Dim img As EditableImage = args.Image
    Dim s As New MemoryStream()
    img.Image.Save(s, img.RawFormat)
    Dim imgData As Byte() = s.ToArray()

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 28 May 2012, 11:57 AM
Hi Kjell,

Saving the image as a file on the server is the default behavior of the Save command. To prevent this behavior you need to cancel the default execution from the event handler, e.g.:
Protected Sub RadImageEditor1_ImageSaving(sender As Object, args As ImageEditorSavingEventArgs)
    args.Cancel = True
    Dim img As EditableImage = args.Image
    Dim s As New MemoryStream()
    img.Image.Save(s, img.RawFormat)
    Dim imgData As Byte() = s.ToArray()
    '......

In addition, you can implement custom content provide for RadImageEditor to utilize a database as a storage. You can find more detailed information on the subject in the following live demo and help article:
http://demos.telerik.com/aspnet-ajax/imageeditor/examples/customcontentprovider/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/imageeditor-using-custom-content-provider.html

Kind regards,
Dobromir
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
ImageEditor
Asked by
Kjell
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or