Skip to content

Instantly share code, notes, and snippets.

@cimm cimm/image_width.js
Created Feb 2, 2015

Embed
What would you like to do?
Get the image width in client side JavaScript
var file = ... // a File web API interface: https://developer.mozilla.org/en-US/docs/Web/API/File
img = new Image();
img.src = URL.createObjectURL(file);
img.onload = function() {
alert(this.naturalWidth);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.