Image file size

Image file size

               
   if (res == "jpg" | res == "png") {   
                        var reader = new FileReader();                       
                        reader.onload = function (e) {
                            $( "#the_image3" ).replaceWith( "<img name='image3' id='image3' src='' alt=''>" );
                            $('#image3').attr('src', e.target.result);
                        }
                   
                        reader.readAsDataURL(input.files[0]);
                        reader.readAsDataURL(input.files[0]);
                    }






I have the above code but how can I check the size of the image? Eg width, height and that it is not over 2mg. Thanks