1.0.1 • Published 10 years ago

image-dimensions-browserify v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

image-dimensions-browserify

Have you ever needed to add an onLoad handler to an image so that your JavaScript can be aware of the image dimensions?

Did that feel silly because the image was right there in the repository and your CSS preprocessor could already do the same?

Given:

var imageWidth = getImageWidth('some-picture.jpg');
var imageHeight = getImageHeight('some-picture.png');
var imageDimensions = getImageDimensions('some-picture.svg');

Result:

var imageWidth = 800;
var imageHeight = 600;
var imageDimensions = {width: 800, height: 600};