Preview a image and get his dimensions


John Clarke
I am using the File Object to load an image into an Image Object. If I use

I get the name of the file excluding the path. When I look at https://cordova.apache.org/docs/en/3.0.0/cordova/file/fileobj/fileobj.html I get the impression that I should be using fullPath. I presume that I need to load the file into my image using :

is that correct ?


DecSoft

Hello John,

If what you wanted is to shown the choosed image (to preview it before upload, for example), just put the below code in the Change event of the Input File control:



John Clarke
If I load an image can I get the Width and Height of the Image ? If so how ?

DecSoft

Hello John,

Yes; we can use the same Change event of the Input File control. Take a look bellow, we do both things: show the image in an Image control, and, get the choosed image dimensions:



John Clarke
Thank you for your help regarding this matter.

DecSoft

You're welcome! :-)


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.