Fixed Canvas size in the controll and hardcode save image path

4 posts, 1 answers
  1. Adeel
    Adeel avatar
    18 posts
    Member since:
    Sep 2014

    Posted 11 Sep 2014 Link to this post

    i have 3 questions:

    How can i fix the canvas size in RadImageEditor?
    How can i hardcode target path in client side to save edited image on that path?
    Can i set image size , resolution , pixel depth while saving my edited image?

    Early response will be appriciated.
    thanks in advance.
  2. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 16 Sep 2014 Link to this post

    Hi Adeel,

    i am not quite sure whether I understand the exact requirements properly. If you want to disable the resizing of the ImageEditor, so the visible part of the canvas will remain the same, you can configure the control's EnableResize property in a similar way:
    <telerik:RadImageEditor ID="RadImageEditor1" runat="server" Width="680" Height="450" EnableResize="false">
    </telerik:RadImageEditor>

    If this is not the case, though, can you please explain in more details the exact scenario you want to achieve?

    Regards,
    Vessy
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adeel
    Adeel avatar
    18 posts
    Member since:
    Sep 2014

    Posted 16 Sep 2014 in reply to Vessy Link to this post

    Thanks for your concern , but you have miss interpreted me. i want to fix the size of drawing CANVAS inside this radimageeditor tool.
    Also other two questions are still in queue for an answer.
    Thank u
  5. Answer
    Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 19 Sep 2014 Link to this post

    Hello Adeel,

    The size of the canvas is created depending on the currently loaded image's dimensions. If you want to fix the size of the canvas, you will need to fix the size of the edited images. For example, if you are giving the user the opurtunity to upload their own image, this can be done in the ImageLoading event in a similar way:
    protected void RadImageEditor1_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
    {
        //Handle Uploaded images
        if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
        {
            using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
            {
                int width = Convert.ToInt32(RadImageEditor1.Width.Value);
                int height = Convert.ToInt32(RadImageEditor1.Height.Value);
                //you might also substract the height of the toolbars here
                image.Resize(width, height); //image.Resize(200, 100);
                args.Image = image.Clone();
                args.Cancel = true;
            }
        }
    }

    In order to save the image to a custom location (was the path to it defined on the server or on the client) in the way demonstrated in the following lie demo: Save Image to a Custom Location
     
    The functionality requested in your last question, though, cannot be currently achieved with the ImageEditor control.

    Regards,
    Vessy
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top