fixed typo in images
This commit is contained in:
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 |
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user