From b9869c11f054430856ff0a0b9bd892e1579a5822 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 8 Apr 2023 19:31:02 -0700 Subject: [PATCH] Update the EXIF table so that it properly formats data from my Canon camera --- assets/styles/photos.css | 2 +- layouts/partials/photo_exif_table.html | 57 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/assets/styles/photos.css b/assets/styles/photos.css index 8a92724..923bc63 100644 --- a/assets/styles/photos.css +++ b/assets/styles/photos.css @@ -119,7 +119,7 @@ font-weight: bold; } -.photo-params tbody tr:first-child > td { +.photo-params tbody tr > td { border: none; border-bottom: 1px solid var(--photo-params-border-color); } diff --git a/layouts/partials/photo_exif_table.html b/layouts/partials/photo_exif_table.html index 569cff0..fbd229f 100644 --- a/layouts/partials/photo_exif_table.html +++ b/layouts/partials/photo_exif_table.html @@ -3,37 +3,62 @@ {{ if and .Tags.Make .Tags.Model }} - + {{ end }} + {{ with .Tags.LensModel }} - {{ if and .Lat .Long }} - + + {{ end }} + + {{- $hasLocation := and .Lat .Long -}} + {{ if $hasLocation -}} + - {{ end }} - {{ if and .Tags.PixelXDimension .Tags.PixelYDimension }} - {{ end }} {{ if or .Tags.ISOSpeedRatings .Tags.FocalLengthIn35mmFilm .Tags.FNumber .Tags.ExposureTime }} - + - + {{ end }}
{{ .Tags.Make }} {{ .Tags.Model }} + {{- $make := .Tags.Make -}} + {{- $model := .Tags.Model -}} + {{- if in $model $make -}} + {{ .Tags.Model }} + {{- else -}} + {{ .Tags.Make }} {{ .Tags.Model }} + {{- end -}} +
+ {{ . }}
{{ $lat := float .Lat }}{{ $latDir := cond (eq $lat 0) "" (cond (gt $lat 0) "N" "S") }} {{ .Lat | lang.FormatNumber (cond (ne $lat 0) 3 0) }}º{{ $latDir }}, {{ $long := float .Long }}{{ $longDir := cond (eq $long 0) "" (cond (gt $long 0) "E" "W") }} {{ .Long | lang.FormatNumber (cond (ne $long 0) 3 0) }}º{{ $longDir }} - {{ $widthpx := .Tags.PixelXDimension }} - {{ $heightpx := .Tags.PixelYDimension }} - {{ if and (gt $widthpx 0) (gt $heightpx 0) }} - {{ $megapixels := div (mul $widthpx $heightpx) 1e6 }} - {{ $megapixels | lang.FormatNumber 0 }} MP - • - {{ $widthpx }} × {{ $heightpx }} - {{ end }} + {{- end -}} + {{ if and .Tags.PixelXDimension .Tags.PixelYDimension -}} + + {{- $widthpx := .Tags.PixelXDimension -}} + {{- $heightpx := .Tags.PixelYDimension -}} + {{- if and (gt $widthpx 0) (gt $heightpx 0) -}} + {{- $megapixels := div (mul $widthpx $heightpx) 1e6 -}} + {{ $megapixels | lang.FormatNumber 0 }} MP + • + {{ $widthpx }} × {{ $heightpx }} + {{- end -}}
{{ with .Tags.ISOSpeedRatings }}ISO {{ . }}{{ end }}{{ with .Tags.FocalLengthIn35mmFilm }}{{ . }} mm{{ end }} + {{- $focalLength := .Tags.FocalLengthIn35mmFilm | default .Tags.FocalLength -}} + {{- with $focalLength -}}{{ . }} mm{{- end -}} + {{ with .Tags.FNumber }}ƒ{{ . }}{{ end }}{{ with .Tags.ExposureTime }}{{ . }} s{{ end }} + {{- with $exposureTime := .Tags.ExposureTime -}} + {{- if in $exposureTime "/" -}} + {{ . }} s + {{- else -}} + 1/{{ printf "%.0f" (div 1.0 (float $exposureTime)) }} s + {{- end -}} + {{- end -}} +