Image Editor control resize

2 posts, 0 answers
  1. Sankar
    Sankar avatar
    1 posts
    Member since:
    Mar 2016

    Posted 29 Mar 2016 Link to this post

    Hi,
    I have a problem with resizing image editor control based on the given width and height. Also resize the control based on image size. Now it looks like by default it is taking some width and height and I can't resize it smaller than that default size.

     

    Thanks

    Sankar

  2. Vessy
    Admin
    Vessy avatar
    1541 posts

    Posted 01 Apr 2016 Link to this post

    Hi Sankar,

    You can resize the ImageEditor depending on the size of the loaded image through its set_width() and set_height() client-side methods. For example, you can do it in its ClientImageLoad event handler.

    For example:
    <telerik:RadImageEditor ID="ImageEditor1" runat="server" ImageUrl="~/Images/PERIC.jpg" OnClientImageLoad="onImageLoad">
        <Tools>
            <telerik:ImageEditorToolGroup>
                <telerik:ImageEditorTool CommandName="Save" />
            </telerik:ImageEditorToolGroup>
        </Tools>
    </telerik:RadImageEditor>
    <script>
        function onImageLoad(imageEditor, args) {
            var editableEl = imageEditor.getEditableElement();
            var width = editableEl.width;
            var height = editableEl.height;
            imageEditor.set_width(width)
            imageEditor.set_height(height)
        }
    </script>

    Regards,
    Vessy
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top