Resizing image size using javascript

Posted by Jean on Stack Overflow See other posts from Stack Overflow or by Jean
Published on 2010-03-20T13:30:16Z Indexed on 2010/03/20 13:31 UTC
Read the original article Hit count: 383

Filed under:
|

Hello,

I am trying to resize the image using javascript, but I am getting errors

 var y;
            var y = new Image();
            y.src = s;
            var wd = y.width/600;
            var ht =  y.height/600;


    if(ht>wd){
        var rw=round(wd * (1/ht));
        var hw1 = ht * (1/ht);
        var hw=round(hw1);
    } else {
        var rw1 = (wd) * (1/wd); 
        rw=round(rw1);
        hw=round(ht * (1/wd));
    }

I am getting errors saying

Message: Object expected Line: 27 Char: 2 Code: 0

Where line 27 is rw=round(rw1);

Thanks Jean

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery