fixed typo in images

This commit is contained in:
2023-12-10 07:43:56 +01:00
parent 543fcdb336
commit 4738bed286
3 changed files with 7 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 230 KiB

View File

@@ -390,25 +390,25 @@ def images(request):
return HTTPFound(location=request.route_url('images'))
# Finally write the data to a temporary file
temp_file_path = os.path.join(folder_path, input_name)
temp_file = os.path.join(folder_path, input_name)
# supprimer le fichier s'il existe déjà
if os.path.exists(temp_file_path):
os.remove(temp_file_path)
if os.path.exists(temp_file):
os.remove(temp_file)
# copie le fichier upload dans temp_file
input_file.seek(0)
with open(temp_file_path, 'wb') as output_file:
with open(temp_file, 'wb') as output_file:
shutil.copyfileobj(input_file, output_file)
# controler la taille du fichier < 4 Mo
filesize = round(os.path.getsize(temp_file_path) / 1024)
filesize = round(os.path.getsize(temp_file) / 1024)
if filesize > 4096:
os.remove(temp_file_path)
os.remove(temp_file)
request.session.flash("ERREUR: La taille du fichier dépasse la limite autorisée. Téléchargement impossible.", 'danger')
return HTTPFound(location=request.route_url('images'))
# using the Python Image Library (PIL) to resize an image
resize_photos(temp_file_path)
resize_photos(temp_file)
request.session.flash('%s : Ce fichier est téléchargé avec succès.' % input_name, 'success')
return HTTPFound(location=request.route_url('images'))