[JavaScript] Not Found JavaScript Code from an External Library of EXIF.js.

[JavaScript] Not Found JavaScript Code from an External Library of EXIF.js.

  

I have a problem in my JavaScript.

I tried to get Exif data from Picture then I used External Library EXIF.js.

But it doesn't move because error occurred "EXIF is not defined".

This is my JavaScript here

function get(){
  var oImg=$parameters.SpotPicture;
  EXIF.getData(oImg, function(){
    Latitude=EXIF.getTag(oImg,"GPSLatitude");
    if (Latitude) {
      Longitude=EXIF.getTag(oImg,"GPSLongitude");
      $parameters.IsExitExifData = true;
      $parameters.Longitude = Latitude;
      $parameters.Latitude = Longitude;
    }else{
      return false;
    }
  });

I had Import Script my module and Screen's Required Script added 'exif.js'.

https://success.outsystems.com/Documentation/10/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_App_Using_JavaScript/Use_JavaScript_Code_from_an_External_Library

I learn how to use External Library from this document.

If you can solve this, please answer this.

Hi, Yuya. The library code might not have been properly loaded. Can you share your espace so I can take a look and see if it's ok?

Hi Yuya,

I nailed it after bruteforcely trying with sample in the site - https://github.com/exif-js/exif-js  :


Here the steps:

0.  Import the javascript to Resources folder, do not forget Deploy action "Deploy to Target Directory"..see also the complete Runtime Path 

1. Use action of HttpRequestHandler;s AddJavaScriptTag, keep an eye on complete directory, and defer set to true (to make sure script not run until page completely uploaded):

2. Put the javascript's function after callback onload. 

3 Put the html target element in Expression on the screen:


May this helps. Good luck. 

regards,

indra 

João Melo wrote:

Hi, Yuya. The library code might not have been properly loaded. Can you share your espace so I can take a look and see if it's ok?

Thank you for Reply, Melo. This is my eSpace. 

I'll  hope solve this problem.

Thank you for reply Indra.


I'd import EXIF.js to my eSpace but, I hadn't  use  action of HttpRequestHandler; AddJavaScriptTag.

So I tried to use "AddJavaScriptTag" before JavaScript.

Then error don't occurred. Maybe it  recognized 'EXIF' tag!!


But, next problem is it can't get Exif Data(GPS) and I do not know how to get it.


If you have some advice to this JavaScript, please contact to me.


This is test picture contained EXIF data. 


Hi, Yuya,

Follow my post above and you'll get the GPS.I try your photo:


regards,

indra