mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-21 23:01:52 +00:00
ROTATE image option
This commit is contained in:
parent
1085a14b92
commit
db3d1ff4ef
@ -407,7 +407,37 @@ def expofilerename(request, filepath):
|
|||||||
and it returns control to the original wallet edit page
|
and it returns control to the original wallet edit page
|
||||||
"""
|
"""
|
||||||
def rotate_image():
|
def rotate_image():
|
||||||
print("ROTATE")
|
wallet = str(Path(filepath).parent).lstrip("surveyscans/")
|
||||||
|
cwd = settings.SCANS_ROOT / wallet
|
||||||
|
print(f"ROTATE \n{cwd=} \n{filename=}")
|
||||||
|
mogrify = settings.MOGRIFY
|
||||||
|
rot = subprocess.run(
|
||||||
|
[mogrify, "-rotate", "90", filename], cwd=cwd, capture_output=True, text=True
|
||||||
|
)
|
||||||
|
msgdata = (
|
||||||
|
rot.stderr
|
||||||
|
+ "\n"
|
||||||
|
+ rot.stdout
|
||||||
|
+ "\nreturn code: "
|
||||||
|
+ str(rot.returncode)
|
||||||
|
)
|
||||||
|
message = f'! - ROTATE - Success: rotated this file {filename}.' + msgdata
|
||||||
|
print(message)
|
||||||
|
if rot.returncode != 0:
|
||||||
|
msgdata = (
|
||||||
|
"Ask a nerd to fix this.\n\n"
|
||||||
|
+ rot.stderr
|
||||||
|
+ "\n\n"
|
||||||
|
+ rot.stdout
|
||||||
|
+ "\n\nreturn code: "
|
||||||
|
+ str(rot.returncode)
|
||||||
|
)
|
||||||
|
message = (
|
||||||
|
f"! - ROTATE - CANNOT blurk for this file {filename}. \n"
|
||||||
|
+ msgdata
|
||||||
|
)
|
||||||
|
print(message)
|
||||||
|
|
||||||
return simple_get()
|
return simple_get()
|
||||||
|
|
||||||
def simple_get():
|
def simple_get():
|
||||||
@ -427,6 +457,7 @@ def expofilerename(request, filepath):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if filepath:
|
if filepath:
|
||||||
|
# using EXPOFILES not SCANS_ROOT in case we want to extend this to other parts of the system
|
||||||
actualpath = Path(settings.EXPOFILES) / Path(filepath)
|
actualpath = Path(settings.EXPOFILES) / Path(filepath)
|
||||||
else:
|
else:
|
||||||
message = f'\n File to rename not specified "{filepath}"'
|
message = f'\n File to rename not specified "{filepath}"'
|
||||||
|
@ -31,7 +31,11 @@ EPOCH = date.fromisoformat('1970-01-01')
|
|||||||
# default value, then gets overwritten by real secrets
|
# default value, then gets overwritten by real secrets
|
||||||
SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"
|
SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"
|
||||||
|
|
||||||
|
# executables:
|
||||||
GIT = "git" # command for running git
|
GIT = "git" # command for running git
|
||||||
|
CAVERN = "cavern" # for parsing .svx files and producing .3d files
|
||||||
|
SURVEXPORT = "survexport" # for parsing .3d files and producing .pos files
|
||||||
|
MOGRIFY = "mogrify" # for rotating images
|
||||||
|
|
||||||
# Note that this builds upon the django system installed
|
# Note that this builds upon the django system installed
|
||||||
# global settings in
|
# global settings in
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}File rename form{% endblock %}
|
{% block title %}File rename or rotate form{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2>Renaming "{{filename}}"</h2>
|
<h2>Renaming or Rotating "{{filename}}"</h2>
|
||||||
<a href="/expofiles/{{filepath|urlencode}}">
|
<a href="/expofiles/{{filepath|urlencode}}">
|
||||||
<figure class=onleft>
|
<figure class=onleft>
|
||||||
<img src="/expofiles/{{filepath|urlencode}}" width=150px>
|
<img src="/expofiles/{{filepath|urlencode}}" width=150px>
|
||||||
@ -23,26 +23,49 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<br>
|
<br>
|
||||||
<input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px "
|
<input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px "
|
||||||
label = "Rename to" name = "renameto" id="renameto"
|
|
||||||
|
label = "Rename to" name = "renametoname" id="renameto"
|
||||||
pattern="[A-Za-z][A-Za-z0-9_-\.]*"/>
|
pattern="[A-Za-z][A-Za-z0-9_-\.]*"/>
|
||||||
<label
|
<label
|
||||||
style="padding: 0.5em 25px; margin-left: 110px"
|
style="padding: 0.5em 25px; margin-left: 110px"
|
||||||
for="renameto">type in the new name for this file<br></label>
|
for="renametoname">type in the new name for this file<br></label>
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
|
|
||||||
<button class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px" type = "submit" value = "Upload" >
|
<button class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px" name="rename" type = "submit" value = "Rename" >
|
||||||
Rename it
|
Rename it
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
<br />
|
||||||
|
<form method ='post' >
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px" name="rotate" type = "submit" value = "Rotate" >
|
||||||
|
Rotate it
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
Full urlencoded path for this file in expofiles is <a href="/expofiles/{{filepath|urlencode}}"><em>{{filepath|urlencode}}</em></a>
|
Full urlencoded path for this file in expofiles is <a href="/expofiles/{{filepath|urlencode}}"><em>{{filepath|urlencode}}</em></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
{% for np in notpics %}
|
||||||
|
<a href="/expofilerename/{{walletpath|urlencode}}/{{np|urlencode}}">{{np}}</a> <br />
|
||||||
|
{% endfor %}
|
||||||
|
<br />
|
||||||
|
{% for filename in files %}
|
||||||
|
<a href="/expofilerename/{{walletpath|urlencode}}/{{filename|urlencode}}">
|
||||||
|
<figure class=onleft>
|
||||||
|
<img src="/expofiles/{{walletpath|urlencode}}/{{filename|urlencode}}" width=75px>
|
||||||
|
<figcaption style="font-variant-caps: normal;">{{filename}}
|
||||||
|
</figcaption>
|
||||||
|
</figure></a>
|
||||||
|
|
||||||
|
{% empty %}
|
||||||
|
No files found.<br />
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user