http://www.google.com/search?hl=en&q=drag+drop+image+resize+javascript&meta=&aq=f&oq=
there are thousands of them pre-written
Image quality will not be preserved on resize unless the image is downloaded at the largest possible size and resized smaller by controls
if the image is displayed at 320*320 and physically is 320*320 enlarging the image makes the browser create 'best fit' interpolated pixels so the resolution is reduced.
Hi-res images add to page load delay times which is undesirable so there is a juggling act between image quality of the resized image, image quality of the original image, how much %age of the users are likely to resize the image, how much page delay is acceptible, as to what size the image is.