Maintaining an image's aspect ratio

4 posts, 1 answers
  1. Roger Withnell
    Roger Withnell avatar
    36 posts
    Member since:
    Nov 2009

    Posted 08 Dec 2009 Link to this post

    When resizing an image in the editor by dragging the handles, how do I maintain the aspect ration?

    Preferably, dragging a corner handle would maintain the aspect ratio and dragging a handle in the middle of a side would not.

    Thanking you in anticipation.

  2. Answer
    Dobromir avatar
    1633 posts

    Posted 10 Dec 2009 Link to this post

    Hi Roger,

    RadEditor is an editable <iframe /> which is based on the rich text editing support of the browsers. Currently FireFox 3 provides this feature while Internet Explorer does not, but it is achievable due to the support of oncontrolselect event. 

    In the following KB article you can find an example of how to implement this feature for Internet Explorer using javascript:

    Resizing images proportional in Internet Explorer

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. dipak
    dipak avatar
    3 posts
    Member since:
    Apr 2011

    Posted 23 Dec 2013 Link to this post

    while resizing or cropping..  is it possible to add "padding" into image so if image is not square and i want it to be square ? and vice versa ?
  4. Ianko
    Ianko avatar
    1956 posts

    Posted 24 Dec 2013 Link to this post

    Hi Dipak,

    You could customize the Crop dialog and add a logic that implements the desired functionality to modify the padding of the image and return the modified image into the ImageEditor instead of the original one. I suggest following this live example, in which is explained how to customize a built-in dialog.

    If you have any difficulties with this approach, I recommend contacting us within a formal support thread. 

    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.
Back to Top