mirror of
https://github.com/FAUSheppy/python-flask-picture-factory
synced 2025-12-07 23:41:36 +01:00
feat: improve display of non-image entities
This commit is contained in:
@@ -140,7 +140,12 @@ def list():
|
|||||||
for f in files:
|
for f in files:
|
||||||
retStringArr += [os.path.join(os.path.basename(root), f)]
|
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'])
|
@app.route("/upload", methods = ['GET', 'POST'])
|
||||||
def upload():
|
def upload():
|
||||||
|
|||||||
@@ -20,16 +20,28 @@
|
|||||||
Public Images List:
|
Public Images List:
|
||||||
</p>
|
</p>
|
||||||
<div class="overview">
|
<div class="overview">
|
||||||
<p>
|
|
||||||
{% for path in paths %}
|
{% for path in paths %}
|
||||||
{% if not "cache" in path %}
|
{% 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"
|
<img alt="{{ path }}" src="/m/{{ path }}?encoding=webp&x=250"
|
||||||
style="max-width: 250px; max-heigh: 250px; overflow: hidden; background: red;">
|
style="max-width: 250px; max-heigh: 250px; overflow: hidden; background: red;">
|
||||||
</img>
|
</img>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% else %}
|
||||||
{% endfor %}
|
<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;">❌</p>
|
||||||
|
<br>
|
||||||
|
<p style="margin-top: 80px; padding-left: 20px; padding-right: 20px">
|
||||||
|
{{ path }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user