Return to Snippet

Revision: 52220
at October 16, 2011 19:43 by taifun


Initial Code
// Get on screen image
var screenImage = $("#image");

// Create new offscreen image to test
var theImage = new Image();
theImage.src = screenImage.attr("src");

// Get accurate measurements from that.
var imageWidth = theImage.width;
var imageHeight = theImage.height;

Initial URL
http://css-tricks.com/snippets/jquery/get-an-images-native-width/

Initial Description

                                

Initial Title
Get Image Dimensions

Initial Tags
jquery

Initial Language
JavaScript