This is a migrated thread and some comments may be shown as answers.
Custom cropping
1 Answer 51 Views
This is a migrated thread and some comments may be shown as answers.
Roger Hendriks
Top achievements
Rank 1
Roger Hendriks asked on 06 Aug 2011, 11:10 AM
As we have fixed image formats for some images I would like to control the cropping from outside the control with javascript and disable the crop option from the toolbar or maybe the whole toolbar. Is this possible?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Aug 2011, 03:37 PM
Hi Roger,

You can try the following:
<telerik:RadImageEditor ID="theImageEditor" runat="server" ImageUrl="~/content/damage.jpg" OnClientCommandExecuted="modifyCommand"></telerik:RadImageEditor>
</form>
<script type="text/javascript">
    function modifyCommand(imageEditor, args) {
        waitForCommand(imageEditor, args.get_commandName(), function (widget) {
            widget._constraintBtn.set_checked(false); //stop the aspect ration constraint
            widget.set_width(100);
            widget.set_height(100);
            widget._updateCropBoxFromControls();
        });
    }
 
    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>

Best 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.

Asked by
Roger Hendriks
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or