Set Canvas to Image Dimensions
(without using an extension)
In the html file below, we load the image from the webviewstring, get the image's height and width, then return these to the webviewstring, without having to actually display the image in the html page!
The html file MUST BE in the same folder as the image files for this to work (in my example, everything is in the assets). If your images are stored elsewhere on the device, then a copy of the html file will need to be made to the images directory - or the directory above the images directory (you will have to change the relative path in the webviewstring you send).
for a single image. I have created the blocks without any variables or substitution for clarity (?)
On button click, we set the webviewstring to the image file (in this case the image is in the assets), and then we call the html file in the webviewer. The html file is also in the assets.
The original landscape image used is 870x464 pixels in size, this has been reduced to 281 x 149 pixels, which is the size of the canvas. The method is to provide images of roughly the same area (width x height). Using 0.5 allows for an area of @ 42000 pixels, regardless of aspect ratio.
Here I setup a small slideshow to show a square image, then portrait, then landscape using the above method, providing variables and substitution where possible. I have attached the aia project.