diff --git a/gallery/templates/gallery/photo_detail.html b/gallery/templates/gallery/photo_detail.html index 0842948..81013f2 100644 --- a/gallery/templates/gallery/photo_detail.html +++ b/gallery/templates/gallery/photo_detail.html @@ -1,4 +1,5 @@ {% extends "base_dark.html" %} +{% load exif_filters %} {% block title %} Gallery : Photo : {{ photo.slug }} {% endblock %} @@ -7,9 +8,9 @@ {% block content %} -
+
-
+
{{ photo.slug }}
+ + + {% if photo.get_prev %} + + {% endif %} + + {% if photo.get_next %} + + {% endif %}
+ -
+
+ +
+
Album name
@@ -57,6 +72,36 @@
+
+
Camera
+
{{ photo.exif.Model }}
+
+
+
Lens
+
{{ photo.exif.LensModel }}
+
+
+
Shutter Speed
+
{{ photo.exif.ExposureTime|exif_exposuretime }}
+
+
+
Aperture
+
{{ photo.exif.FNumber|exif_fnumber }}
+
+
+
ISO
+
{{ photo.exif.ISOSpeedRatings|exif_isospeedratings }}
+
+
+
Focal Length
+
{{ photo.exif.FocalLength|exif_focallength}}
+
+
+
Focal Length
+
{{ photo.exif.FocalLengthIn35mmFilm|exif_focallength }}
+
+ +
{% if prev %} @@ -80,7 +125,7 @@ -
-
+
+ {% endblock %} \ No newline at end of file diff --git a/gallery/templates/gallery/photo_list.html b/gallery/templates/gallery/photo_list.html index 8882277..0a234e5 100644 --- a/gallery/templates/gallery/photo_list.html +++ b/gallery/templates/gallery/photo_list.html @@ -14,7 +14,7 @@ {% load link_tags %} -
    +
    • Latest
    • Liked
    • Popular
    • diff --git a/gallery/templatetags/exif_filters.py b/gallery/templatetags/exif_filters.py new file mode 100644 index 0000000..5967f75 --- /dev/null +++ b/gallery/templatetags/exif_filters.py @@ -0,0 +1,47 @@ +from django import template +from django.utils.text import slugify +from unidecode import unidecode + +register = template.Library() + + +@register.filter(name="unislugify") +def unislugify(value): + """Convert to ASCII""" + return slugify(unidecode(value)) + + +@register.filter(name="exif_exposuretime") +def exif_exposuretime(value): + """Convert ExposureTime""" + try: + return f"1/{int(1/float(value))} sec" + except: + return "" + + +@register.filter(name="exif_fnumber") +def exif_fnumber(value): + """Convert FNumber""" + try: + return f"ƒ/{float(value)}" + except: + return "" + + +@register.filter(name="exif_focallength") +def exif_focallength(value): + """Convert Focal Length""" + try: + return f"{int(value)} mm" + except: + return "" + + +@register.filter(name="exif_isospeedratings") +def exif_isospeedratings(value): + """Convert ISO Speed Ratings""" + try: + return f"{int(value)}" + except: + return "" \ No newline at end of file