ImageSaving

2 posts, 0 answers
  1. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 24 May 2012 Link to this post

    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()
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 28 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top