Metadata of a document

Hi,

I want to know how to get metadata of an image (like geolocation containing latitude and longitude). Is there a way to get it at all?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to Harshit Bumb (Appyzie)

    It'd probably be... not *too* difficult, maybe, for someone to write a custom plug-in to do this analysis on relevant files - but that would be its own whole new thing, someone would need to be used to coding plugins (and have a setup that allows for it), etc.

  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    How about using chatGPT for it? Generated this code from it. Not sure how much of it is correct Stuck out tongue

    import com.appiancorp.plugins.sdk.PluginContext;
    import com.appiancorp.plugins.sdk.ui.EmbeddedBrowser;
    import com.appiancorp.plugins.sdk.ui.TextValueComponent;
    
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    
    public class GeoLocationPlugin {
    
      public static void extractGeoLocation(PluginContext context, String filePath) {
        try {
          File imageFile = new File(filePath);
          BufferedImage image = ImageIO.read(imageFile);
          double latitude = extractLatitude(image);
          double longitude = extractLongitude(image);
          String location = String.format("%f,%f", latitude, longitude);
          TextValueComponent locationComponent = context.createTextValueComponent(location);
          EmbeddedBrowser browser = context.createEmbeddedBrowser(locationComponent);
          browser.setWidth(400);
          browser.setHeight(300);
          browser.setUrl(String.format("https://www.google.com/maps?q=%s", location));
          context.publishValue(locationComponent);
        } catch (IOException e) {
          context.logError("Failed to extract geo location from image", e);
        }
      }
    
      private static double extractLatitude(BufferedImage image) {
        // TODO: Implement the logic to extract the latitude from the image.
        // This may involve reading the EXIF metadata of the image, if available.
        return 0.0;
      }
    
      private static double extractLongitude(BufferedImage image) {
        // TODO: Implement the logic to extract the longitude from the image.
        // This may involve reading the EXIF metadata of the image, if available.
        return 0.0;
      }
    }
    

  • 0
    Certified Lead Developer
    in reply to Harshit Bumb (Appyzie)

    From a first glance it looks like it may have just generated you a placeholder...