You should create an Image object (this is the standard HTML5 API)
The corresponding snippet is copied from this answer:
HTML5 - how to get image size
From the plugin document: "The image is passed to the success callback as a Base64 encoded string or as a URI for the image file"
If you choose base64 format in the camera plugin, the data URI will be
'data:image/jpg;base64,' + imageData
However, the doc plugin recommends a file format that will return a file URL that you can assign directly to your image.src
var image = new Image(); image.onload = function(evt) { var width = this.width; var height = this.height; alert (width);
As you can see, the method is asynchronous, you can wrap it in Promise
or emit an event when the image has been loaded and you have width x height
source share