#!/bin/bash # exif.cgi - EXIF Display Script # Author: Sean B. Palmer, inamidst.com # License: Eiffel Forum License 2 echo 'Content-Type: text/html; charset=utf-8' echo exiftool=$(which exiftool) if [[ ! -x $exiftool ]] then exiftool=$DOCUMENT_ROOT/odds/exiftool/exiftool fi function decode() { echo -e $(echo $1 | sed 's/%/\\x/g') } function get() { decode $(echo $2 | egrep -o "$1=[^&]+" | sed "s/$1=//") } function snarf() { uri=$1 case $uri in http://$SERVER_NAME/*) fn=$DOCUMENT_ROOT/${uri#http://$SERVER_NAME/}.jpg if [[ -f $fn ]] then cat $fn exit fi;; *) curl -s $uri;; esac } uri=$(get uri $(cat)) echo '' echo "EXIF Information - $uri" cat < body { margin: 1em } h1, h2 { font-weight: normal }

About This Image

EOF echo "

" snarf $uri | $exiftool -a -u -g1 - | \ sed " s%^---- %

%; s% ----$%

%; s%^[A-Za-z0-9]%
&%; s% *:%:%; s%[A-Za-z0-9]$%&
% " echo '

The information above is the EXIF information for the image
' echo 'shown, derived using the exiftool program.

' echo '

(Source)

' # EOF