Skip to content

Commit

Permalink
Limit image size. Link to tinypng
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jun 3, 2022
1 parent e4d584b commit 8d86ce2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@
"allowed_mime_types": ["image/png", "image/svg+xml", "image/gif", "image/jpg", "image/jpeg"], # ["image/*"] ?
"upload_expiration": 60 * 60, # in seconds
"key_path": "default", # appended before the file key. No backslash!
"max_files": 1, # 3,
"max_file_size": 5, # in mb
"max_files": 1,
"max_file_size": 2, # in mb
"timeout": 20000, # in ms
},
"question_answer_image": {
Expand Down
3 changes: 2 additions & 1 deletion templates/questions/detail_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
<label for="image_form" class="js-display-if-javascript-enabled">{{ form.answer_image_url.label }}</label>
{% include "includes/_s3_upload_form.html" with dropzone_form_id="image_form" %}
</div>
<small>Image trop grosse ? pour réduire la taille d'une image : <a href="https://tinypng.com" target="_blank">tinypng.com</a></small>
</div>
<div class="col-12 col-sm-6">
<div class="form-group">
<label>Image actuelle</label>
<label class="form-label">Image actuelle</label>
{% if form.answer_image_url.value %}
<div>
<img class="img-fluid" src="{{ form.answer_image_url.value }}" />
Expand Down
3 changes: 2 additions & 1 deletion templates/quizs/detail_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
<label class="form-label" for="image_form" class="js-display-if-javascript-enabled">{{ form.image_background_url.label }}</label>
{% include "includes/_s3_upload_form.html" with dropzone_form_id="image_form" %}
</div>
<small>Image trop grosse ? pour réduire la taille d'une image : <a href="https://tinypng.com" target="_blank">tinypng.com</a></small>
</div>
<div class="col-12 col-sm-6">
<div class="form-group">
<label>Image actuelle</label>
<label class="form-label">Image actuelle</label>
{% if form.image_background_url.value %}
<div>
<img class="img-fluid" src="{{ form.image_background_url.value }}" />
Expand Down

0 comments on commit 8d86ce2

Please sign in to comment.