1

I'm trying to get the image width and height of an image file, right after it has uploaded to the server, but I can't seem to get the creation of this image from a file done correctly. I'm wondering if it's possible to do without a file reader or too much trouble in general, but then if there was a simple method I would've probably already tried it . . .

This is the code:

'onUploadComplete' : function(fileObj) {
            var theImage = new Image();
            theImage.src = fileObj.attr(fileObj);
            // Get accurate measurements from that.
            var imageWidth = theImage.width();
            var imageHeight = theImage.height();
            alert('The image file ' + fileObj.name + ' has the following resolution: ' + imageWidth + 'px X ' + imageHeight + 'px.');
        },

Right now nothing happens, but if I remove the imageWidth and imageHeight from the alert it fires, so I'm thinking it's not creating the image right and I tried a few things, but so far to no avail . . .

Jimmi Lee
  • 73
  • 1
  • 11

0 Answers0