Reading EXIF data from image
However I'm not able to pass the image argument into the script from QML. Just keep getting warnings like this:
simple_one.qml:30: TypeError: Result of expression 'EXIF.getTag' [undefined] is not a function.
Here is how I try to do it:
@import "exif.js" as EXIF
text: EXIF.getTag("photos/12092009401.jpg", "Model")
Seems that the argument of image should be passed to the exif.js in some other way. Any ideas what I'm doing wrong here?
The values exported from exif.js are put on a global object named EXIF (incidentally the same as your import). In a normal browser environment you would access them by using EXIF.Tags, EXIF.getTag etc.
So anything declared on the global context inside the exif.js is available on that additional EXIF object.
So - to make complicated things short:
To access your functions you have to call @EXIF.EXIF.getTag@.
You could also change exif.js and remove the closure and have all the functions and constants directly on the global context.