add size requirement for banners

pull/225/head
Aevann 2024-03-09 13:52:20 +02:00
parent 89843d7cb2
commit e1c446b910
2 changed files with 11 additions and 0 deletions

View File

@ -63,6 +63,11 @@ def submit_art_post(v):
file.save(highquality)
process_image(highquality, v) #to ensure not malware
with Image.open(highquality) as i:
if i.width != 2000 or i.height != 200:
os.remove(highquality)
abort(400, "Banners must be 2000x200")
path = f"files/assets/images/{SITE_NAME}/{entry.location_kind}"
if not entry.hashes:
for img in os.listdir(path):

View File

@ -20,6 +20,12 @@
</label>
</div>
{% if kind == 'Banner' %}
<div class="mt-3 text-danger font-weight-bold">
Please make sure your image is 2000x200 px
</div>
{% endif %}
<label class="mt-3" for="author">Author</label>
<input autocomplete="off" type="text" id="author" class="form-control" name="author" maxlength="30" pattern='[a-zA-Z0-9_\-]{1,30}|\?{3}' placeholder="Required" value="{{username}}" required>