Webcam support to use it as a photomaton ( photobooth ) #2

Merged
n07070 merged 11 commits from webcam into master 2022-05-10 00:03:46 +02:00
Showing only changes of commit cd663087c8 - Show all commits

View File

@ -122,17 +122,24 @@ def api_print_image():
sign = request.form["signature"]
except Exception as e:
flash(str(e),'error')
redirect(url_for('index'))
app.logger.error(str(e) + " - Whoops, no forms submitted or missing signature.")
return redirect(url_for('index'))
if request.method == 'POST':
# check if the post request has the file part
if 'img' not in request.files:
flash('No file found. Did you use the good form ?', 'error')
return redirect(url_for("index"))
else:
file = request.files['img']
try:
if 'img' not in request.files:
flash('No file found. Did you use the good form ?', 'error')
app.logger.error("No file found. Did you use the good form ?")
return redirect(url_for("index"))
else:
file = request.files['img']
except Exception as e:
if sign is not None and photo is not None:
pass
else:
flash(str(e), 'error')
app.logger.error("Couldn't get an image nor signature : " + str(e))
# If the user does not select a file, the browser submits an
# empty file without a filename.