I have an image upload form with image preview. When a user selects an image from their desktop, the image is displayed in the preview before upload. I want to get the width of that image if possible but I don't know how to get it. I have the following code:

HTML Code:
function readURL(input) {
	if (input.files && input.files[0]) {
		var reader = new FileReader();
		reader.onload = function (e) {
			$('#preview').attr('src', e.target.result).css('width', ???);
I have ??? in where I want to get the selected image width. Do you have any ideas how to do that?