Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

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

...

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

Tip

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



Kodeblok
titleupdatePages.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" macro User Macro - the part that renders the image on the Confluence page

Tip

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:

Kodeblok
## @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:

Image Added

Links to:

Image Added