No save on server, aspect ration and more

3 posts, 0 answers
  1. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 16 Sep 2011 Link to this post

    First of all - Congratulations

    Having the option to set an aspect ratio is a super cool feature. Unfortunately I did not find where I can set my own ratios like 16:9 or 4:3 for example.

    It would also be nice if I could reset the first image

    Any ideas

    Markus
  2. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 19 Sep 2011 Link to this post

    Hello Markus,

    The code below shows how to add a new item to the aspect ratio dropdowns of the Crop and Resize dialogs of RadImageEditor. You can use it as a base to implement your scenario:

      <telerik:RadImageEditor ID="RadImageEditor1" runat="server" OnClientCommandExecuting="modifyCommand" ImageUrl="~/Images/Vucko.jpg">
          <Tools>
              <telerik:ImageEditorToolGroup>
                   <telerik:ImageEditorTool CommandName="Reset" ToolTip="Reset Image" />
                  <telerik:ImageEditorToolSeparator />
                  <telerik:ImageEditorTool CommandName="Resize" ToolTip="Resize" />
                  <telerik:ImageEditorTool CommandName="Crop" ToolTip="Crop" />
              </telerik:ImageEditorToolGroup>
          </Tools>
      </telerik:RadImageEditor>
    <script type="text/javascript">
        function modifyCommand(imageEditor, args) {
            var commandName = args.get_commandName();
            if (commandName) {
                waitForCommand(imageEditor, commandName, function (widget) {
                    if (commandName == "Crop") {
                        var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                        comboItem.set_text("16:9");
                        comboItem.set_value("20,20");
                        widget._presetDD.get_items().add(comboItem);
                    }
                    else if (commandName == "Resize") {
                         
                        var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                        comboItem.set_text("16:9");
                        comboItem.set_value("20,20");
                        widget._comboSizes.get_items().add(comboItem);
                    }
                });
            }
        }
     
        function waitForCommand(imageEditor, commandName, callback) {
            var timer = setInterval(function () {
                var widget = imageEditor.get_currentToolWidget();
                if (widget && widget.get_name() == commandName) {
                    clearInterval(timer);
                    callback(widget);
                }
            }, 100);
        }
      </script>



    Kind regards,
    Rumen
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 19 Sep 2011 Link to this post

    Dear Rumen

    It does work on the Crop not on the Resize?

    Crop uses _presetDD
    Resize uses _coboSizes

    Is this correct.

    Wouldn't it make sense to inculde this in the help file as soon as possible.

    Of course it would be nice if this could be set via a tools.xml file more easely then to use JS.

    Thanks again.

    Great tool. Missed such a funtionality for a very long time and finaly am able to provide this to my customers.

    Markus
Back to Top