Crop then Resize

3 posts, 1 answers
  1. arnaud
    arnaud avatar
    100 posts
    Member since:
    Jul 2008

    Posted 25 Jun 2012 Link to this post

    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. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts
    Member since:
    Sep 2012

    Posted 28 Jun 2012 Link to this post

    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.

  3. DevCraft Release
  4. arnaud
    arnaud avatar
    100 posts
    Member since:
    Jul 2008

    Posted 29 Jun 2012 Link to this post

    Thank You Dobromir, that's perfect.

Back to Top