ImageEditor script error occurs

3 posts, 0 answers
  1. WonYoung
    WonYoung avatar
    1 posts
    Member since:
    Oct 2013

    Posted 31 Oct 2013 Link to this post

    HI
    I have an image cropping issue in telerik image editor.
    An script error occurs when Crop button click in Dialog Box.
    And cropping does not work.
    It only resize the image.

    I doesn't use session at image editing and loading.

    dll file version : 2013.2.611.35

    << aspx page >>
    -------------------------------------------------------------------------------------------------

    <telerik:RadImageEditor runat="server" ID="RadImageEditor1" Visible="false" OnImageEditing="RadImageEditor1_ImageEditing" CanvasMode="No" OnImageLoading="RadImageEditor1_ImageLoading" ShowAjaxLoadingPanel="true" ImageCacheStorageLocation="Session">
      <Tools>
       <telerik:ImageEditorToolGroup>
                    <telerik:ImageEditorTool CommandName="Save" Text="Image Apply"/>
           <telerik:ImageEditorToolSeparator />
           <telerik:ImageEditorToolStrip CommandName="Reset" Text="Reset" />
           <telerik:ImageEditorToolStrip CommandName="Undo" Text="Undo" />
           <telerik:ImageEditorToolStrip CommandName="Redo" Text="Redo" />
           <telerik:ImageEditorToolSeparator />
           <telerik:ImageEditorTool CommandName="Crop" />
           <telerik:ImageEditorTool CommandName="Resize" />
           <telerik:ImageEditorTool CommandName="Zoom" />
           <telerik:ImageEditorTool CommandName="ZoomIn" />
           <telerik:ImageEditorTool CommandName="ZoomOut" />
           <telerik:ImageEditorTool CommandName="Opacity" />
           <telerik:ImageEditorTool CommandName="Rotate" />
           <telerik:ImageEditorTool CommandName="RotateRight" />
           <telerik:ImageEditorTool CommandName="RotateLeft" />
           <telerik:ImageEditorTool CommandName="Flip" />
           <telerik:ImageEditorTool CommandName="FlipVertical" />
           <telerik:ImageEditorTool CommandName="FlipHorizontal" />
           <telerik:ImageEditorTool CommandName="AddText" />
       </telerik:ImageEditorToolGroup>
      </Tools>    
         </telerik:RadImageEditor>

    -------------------------------------------------------------------------------------------------


    << aspx.cs page >>
    path  ex )   D:\dpimage\temp\editor\2013\10\31\14\428606850_20131031144126.jpg
    -------------------------------------------------------------------------------------------------

    protected void RadImageEditor1_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
            {
                args.Image = new EditableImage(path);
                args.Cancel = true;
            }

    protected void RadImageEditor1_ImageEditing(object sender, ImageEditorEditingEventArgs args)
            {
                args.Cancel = true;

                try
                {
                    string d = DateTime.Now.ToString("yyyy-MM-dd-HH").Replace("-", "\\");
                    path = imagePath(source);

                    var thumbImage = args.Image.Clone();

                    var ms = new MemoryStream();
                    thumbImage.Image.Save(ms, thumbImage.RawFormat);

                    File.WriteAllBytes(path, (byte[])ms.ToArray());

                    result_url = path.Replace(RootPath, dpimage_url).Replace("\\", "/");

                    args.Argument = "OK," + result_url;
                }
                catch (Exception ex)
                {
                    args.Argument = ex.Message + ", ";
                    throw ex;
                }
            }
    -------------------------------------------------------------------------------------------------

  2. Vessy
    Admin
    Vessy avatar
    1385 posts

    Posted 05 Nov 2013 Link to this post

    Hello Won,

    The ImageEditing event fires just before the image is edited on the server. In case its event arguments are canceled the corresponding server-side operation is never applied. removing the following line should fix the issue:
    protected void RadImageEditor1_ImageEditing(object sender, ImageEditorEditingEventArgs args)
        {
            //args.Cancel = true;
            ...

    I hope this helps.

    Regards,
    Veselina Raykova
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Arron
    Arron avatar
    22 posts
    Member since:
    Apr 2013

    Posted 11 Dec 2013 Link to this post

    Hi, I am also testing with the related image editing projects these days. I wonder whether there are some differences between them. Do you have any ideas about it? Or any good suggestion? Thanks in advance.



    Best regards,
    Arron
Back to Top