2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-01-19 08:14:17 +00:00

starting rotate on cave descrip images

This commit is contained in:
2025-07-31 20:32:48 +02:00
parent c2c70e6a95
commit 08e545f03a
2 changed files with 18 additions and 7 deletions

View File

@@ -54,12 +54,6 @@ todo = """
own directory 16xx/NNN/ even if they have no images to put in it.
"""
# def cavepagefwd(request, karea=None, subpath=None):
# """archaic, just send to the caves list page
# """
# return redirect("/caves")
def get_cave_from_slug(caveslug):
"""Needs refactoring
"""

View File

@@ -92,6 +92,21 @@ def reorient_image(img, exif_dict):
# print(f"reorient_image(): found ImageIFD.Orientation in 0th ")
# for ifd in exif_dict:
# print(f"reorient_image(): \"{ifd}\"\n {exif_dict[ifd]} ")
# documentation from http://sylvana.net/jpegcrop/exif_orientation.html
# for i
# do
# case `jpegexiforient -n "$i"` in
# 1) transform="";;
# 2) transform="-flip horizontal";;
# 3) transform="-rotate 180";;
# 4) transform="-flip vertical";;
# 5) transform="-transpose";;
# 6) transform="-rotate 90";;
# 7) transform="-transverse";;
# 8) transform="-rotate 270";;
# *) transform="";;
# esac
orientation = exif_dict["0th"].pop(piexif.ImageIFD.Orientation)
if orientation == 2:
@@ -226,8 +241,10 @@ def extract_gps(dict):
print(altitude)
print(timestamp_utc)
# location = dms2dd() # to do...
rotate_this = f"?to_be_rotated" # this should rotate the i/ and t/ images and then re-render the same page.
rotate_button = f"<br /><a href='{rotate_this}'><b>&olarr;</b>&nbsp;</a>rotate this image"
return f"{direction}<br />{location}<br />{altitude}</br />{timestamp_utc}<br />"
return f"{rotate_button}<br />{direction}<br />{location}<br />{altitude}</br />{timestamp_utc}<br />"
def fix_dump_bugs(exif_dict):
"""piexif has several bugs, this gets around it.