Image is not saved after rotation

8 posts, 0 answers
  1. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 26 Feb 2012 Link to this post

    Hi
    I'm using RadImageEditor to edit an image. Every time when I rotate the image, it seems the image is not saved when I use imgEditor.GetEditableImage(). Any ideas?



  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 29 Feb 2012 Link to this post

    Hi Chen,

    By design, RadImageEditor collects all operations applied to the image before execute them, and then after saving is triggered all the operations are applied on the server following the order of the stack collected on the client. This is approach is used to be able to provide Undo / Redo functionality and to reduce the number of executed callbacks. Flip, Rotate and Resize are initially visually applied on the client and when the image is saved all client-side operations are applied on the server.

    You can force image saving to apply client-side modifications using the applyChangesOnServer() client-side method of RadImageEditor, e.g.:
    <telerik:RadImageEditorID="RadImageEditor1"runat="server"ImageUrl="~/ROOT/Sunset.jpg">
    </telerik:RadImageEditor>
      
    <asp:ButtonText="text" runat="server" OnClientClick="applyModifications();return false;"/>
      
    <script type="text/javascript">
        function applyModifications()
        {
            $find("<%=RadImageEditor1.ClientID %>").applyChangesOnServer();
        }
    </script>


    Greetings,
    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
  4. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 29 Feb 2012 Link to this post

    Thanks Dobromir.

    The image is read from database in binary format. How client method applyChangesOnServer() can trigger a server method to update the image data?  
     
     
    Just one more question. Is it possible to customize the popup 
    dialogue when clicking the built-in 'Save' command? I would like to skip the dialogue and save any changes . 
  5. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 01 Mar 2012 Link to this post

    Hi Chen,

    Please accept my sincere apologies for not being clear enough in my previous answer.

    RadImageEditor applies modifications made to the actual image file using callbacks. Most of the commands, except AddText, Crop and InsertImage, initially are only visualized on the client and are stored in a queue, and when a server-side Save event is triggered all the stored commands get applied to the actual image file.

    The RadImageEditor's client-side method applyChangesOnServer() is triggering the ImageChanging server-side event and can be used to manually force the modifications that are only visualized at this point to be actually applied to the editableImage.

    Now regarding your second question, you can modify the Save command to avoid the dialog and directly save the image on the server by handling the OnClientCommandExecuting client-side event of RadImageEditor, e.g.:
    <telerik:RadImageEditor ID="RadImageEditor1" runat="server" ImageUrl="~/ROOT/SAM_0310.JPG" OnImageSaving="RadImageEditor1_ImageSaving" OnClientCommandExecuting="imageEditorCommandExecuting">
        <Tools>
            <telerik:ImageEditorToolGroup>
                <telerik:ImageEditorTool CommandName="Save" />
                <telerik:ImageEditorTool CommandName="RotateLeft" />
                <telerik:ImageEditorTool CommandName="RotateRight" />
            </telerik:ImageEditorToolGroup>
        </Tools>
    </telerik:RadImageEditor>
    <script type="text/javascript">
        function imageEditorCommandExecuting(imageEditor, args)
        {
            if (args.get_commandName() == "Save") {
                args.set_cancel(true);
     
                imageEditor.saveImageOnServer("ImageName", true);
            }
     
        }
    </script>

    You can find detailed information regarding the RadImageEditor's client-side API in our online documentation.

    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.
  6. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 02 Mar 2012 Link to this post

    Dobromir,

    Thanks for your detail explanation. It helps me a lot.
    Just one more question. Does this OnClientCommandExecuting client method work with RadAjaxManager? Will it fire AjaxLoadingPanel?
    Thanks
  7. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 05 Mar 2012 Link to this post

    Hello,

    You can use the solution provided in the following demo Explicit Show/Hide to show the AjaxLoadingPanel in the OnClientCommandExecuting client side event of RadImageManager.

    All the best,
    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.
  8. vab
    vab avatar
    5 posts
    Member since:
    Apr 2008

    Posted 14 Feb 2013 Link to this post

    this is not working at my side

    how this javascript function will get called
  9. Vessy
    Admin
    Vessy avatar
    1383 posts

    Posted 19 Feb 2013 Link to this post

    Hi Vab,

    If you are talking about the imageEditorCommandExecuting() function, it has to be assigned as a handler to the the OnClientCommandExecuting event:
    <telerik:RadImageEditor ID="RadImageEditor1" runat="server" ImageUrl="~/ROOT/SAM_0310.JPG" OnClientCommandExecuting="imageEditorCommandExecuting">
    ...

    If no - could you elaborate on which JavaScript function exactly do you want to call?

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