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! :-)


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.