This is a migrated thread and some comments may be shown as answers.

No save on server, aspect ration and more

2 Answers 149 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 16 Sep 2011, 05:20 PM
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 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Sep 2011, 03:02 PM
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
0
Markus
Top achievements
Rank 2
answered on 19 Sep 2011, 04:02 PM
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
Tags
ImageEditor
Asked by
Markus
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Markus
Top achievements
Rank 2
Share this question
or