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

Crop then Resize

2 Answers 95 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
arnaud
Top achievements
Rank 1
arnaud asked on 25 Jun 2012, 10:11 AM
Hi,

I'm trying to Resize the image as soon as the image is cropped, without success.

I thought about something like this (does not work):

function OnClientImageChanged(imageEditor, args) {
                 
               
                    if (args.get_commandName() == "Crop") {
 
                        imageEditor.resizeImage(150, 250, true)
 
                    }
            
 
            }

or this (work but loop indefinitely) :

function OnClientImageChanged(imageEditor, args) {
               if (args.get_commandName() == "Crop") {
                   var timer = setInterval(function () {
                       imageEditor.resizeImage(150, 250, true)
                   }, 100);
               }
           }

How would you do that ? I'm using the last Telerik dll so doing something inside the 'Crop.ascx' ImageEditorDialogs is possible if its the way to go.

Thanks Arnaud

2 Answers, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 28 Jun 2012, 06:39 AM
Hi Arnaud,

At present, you can achieve the required result using the OnClientImageChanged event of RadImageEditor using a timeout, e.g.:

function imgEditorImageChanged(imgEditor, args) {
    setTimeout(function(){
        if(args.get_commandName() == "Crop")
            imgEditor.resizeImage(50, 50, true);
    }, 300);
}

The need of a timeout comes from the fact that the ClientImageChanged event is fired when the client-side command is executed but the Crop command also executes server-side functionality which happens after that.


Kind regards,
Dobromir
the Telerik team
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 their blog feed now.
0
arnaud
Top achievements
Rank 1
answered on 29 Jun 2012, 08:26 AM
Thank You Dobromir, that's perfect.
Tags
ImageEditor
Asked by
arnaud
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
arnaud
Top achievements
Rank 1
Share this question
or