feat: improve display of non-image entities

This commit is contained in:
2023-06-27 16:03:42 +02:00
parent 9d38617dff
commit 77c9a1b6d4
2 changed files with 21 additions and 4 deletions

View File

@@ -140,7 +140,12 @@ def list():
for f in files:
retStringArr += [os.path.join(os.path.basename(root), f)]
return flask.render_template("index.html", paths=retStringArr)
isPictureDict = dict()
for p in retStringArr:
isPicture = any([x in p for x in ["jpg", "png", "wep", "svg"]])
isPictureDict.update({ p : isPicture })
return flask.render_template("index.html", paths=retStringArr, isPictureDict=isPictureDict)
@app.route("/upload", methods = ['GET', 'POST'])
def upload():

View File

@@ -20,16 +20,28 @@
Public Images List:
</p>
<div class="overview">
<p>
{% for path in paths %}
{% if not "cache" in path %}
<a href="/m/{{ path }}">
{% if isPictureDict[path] %}
<a href="/m/{{ path }}" style="display: inline-block; float: left; margin: 5px;">
<img alt="{{ path }}" src="/m/{{ path }}?encoding=webp&x=250"
style="max-width: 250px; max-heigh: 250px; overflow: hidden; background: red;">
</img>
</a>
{% else %}
<a href="/m/{{ path }}" style="display: inline-block; float: left; magin: 5px;
word-break: break-all;">
<div style="height: 150px; width: 250px; background: aliceblue;">
<p style="font-size: 40px; position: fixed; margin-left: 80px;
margin-top: 20px;">&#10060;</p>
<br>
<p style="margin-top: 80px; padding-left: 20px; padding-right: 20px">
{{ path }}
</p>
</div>
</a>
{% endif %}
{% endif %}
{% endfor %}
</p>
</div>
</body>