javascript crop and resize image before upload