Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- img = document.getElementById("edit-photo-frame");
- var x=parseInt(img.width);
- var y=parseInt(img.height);
- if (x>maxWidth) {
- y*=maxWidth/x;
- x=maxWidth;
- }
- if (y>maxHeight) {
- x*=maxHeight/y;
- y=maxHeight;
- }
- img.style.display=(x<1 || y<1)?"none":"";
- img.src=evt.target.result;
- img.width=x;
- img.height=y;
- }
Add Comment
Please, Sign In to add comment