To add some new stuff to the Mos-Eisley Gallery, I decided to extract EXIF data and use the GPS part. Inspired by this article: https://exposingtheinvisible.org/resources/image-digging

So, I added the exiftool to the Ubuntu server running Confluence, and added 2 code parts to the code:

makeThumbs.sh
#Extract EXIF data if the file does not exist
  if [ ! -f $StartDir/$dir/$pic.exif ]
  then
       #Extract EXIF data
       exiftool -c "%.6f" $pic > $pic.exif
       echo "extracting EXIF data from $pic"
  fi

This little piece extracts EXIF to a file placed alongside the image.

I am giving the EXIF files the .exif filename extension, so they are easy to identify and delete.



updatePages.sh
# EXIF Support

  if [ -f $MediaRoot/$Dir/$file/$image.exif ]
  then

      # An EXIF file exists for the Image

      GPSPos=$(cat "$MediaRoot/$Dir/$file/$image.exif" | grep "GPS Position" | sed 's/GPS\ Position//g' | sed 's/://g')
      Lattitude=$(echo $GPSPos | awk -F "," '{ print $1 }')
      Longitude=$(echo $GPSPos | awk -F "," '{ print $2 }')

  fi


....
....


    echo "{me-image:path=$Dir/$file2|image=$image|group=$group|thumbsize=$ThumbSize|displaysize=$DisplaySize|lattitude=$Lattitude|longitude=$Longitude}" >> $WikiPageFile


  else

   echo "{me-image:path=$Dir/$file2|image=$image|group=$group|thumbsize=$ThumbSize|displaysize=$DisplaySize|lattitude=$Lattitude|longitude=$Longitude}" >> $WikiFile

This next part extracts the Lattitide and Longitude from the EXIF file, and adds the data to the "me-image" User Macro - the part that renders the image on the Confluence page

For Open Street Maps its actually not nessesary to split Lattitude and Longitude (smil)


finally, I needed to add support to the "me-image" User Macro:

## @param lattitude:title=Lattitude|type=string|required=false|desc=Lattitude Geocoordinat
## @param longitude:title=Longitude|type=string|required=false|desc=Longitude Geocoordinat


....
....


#if (${paramlattitude} != "" &&  ${paramlongitude} != "" && ${paramlattitude} && ${paramlongitude} )
<br>View photo location on Open Street Map: <a href="https://www.openstreetmap.org/search?query=${paramlattitude},${paramlongitude}&namedetails=1&zoom=18&addressdetails=1" target="_location"><img src="http://www.mos-eisley.dk/download/attachments/28344459/OpenStreetMapIcon.png?api=v2" width=20px></a>
#end


Now, if the Image has GPS coordinates, a small icon will be rederen with a link to Open Street Maps:

Links to: