From 5d3133a3a9918540a4e14921499b3ec1919d4987 Mon Sep 17 00:00:00 2001 From: cleontay Date: Tue, 30 May 2023 18:47:57 +0800 Subject: [PATCH] Updated to 8 bit checkbox --- Application/lsb_rep.py | 12 ++++++------ Application/views/decode.html | 12 ++++++++++-- Application/views/encode.html | 12 +++++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Application/lsb_rep.py b/Application/lsb_rep.py index 5a84838..a304e64 100644 --- a/Application/lsb_rep.py +++ b/Application/lsb_rep.py @@ -4,10 +4,7 @@ import cv2 import os import sys -script_directory = os.path.dirname(os.path.abspath(sys.argv[0])) -current_directory = os.getcwd() - -WORKING_PATH = os.path.relpath(script_directory, current_directory) +WORKING_PATH = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "upload") + os.sep app = Flask(__name__, template_folder='views') app.secret_key = 'b3a5e8d11fb3d8d3647b6cf2e51ad768' @@ -30,7 +27,8 @@ def encode(): @app.route("/encoding", methods=['POST']) def encoding(): file = request.files['origin'] - b2c = [int(request.form['b2c'])] + b2c = [int(x) for x in request.form.getlist("b2c")] + # b2c = [int(request.form['b2c'])] payload = request.form['payload'] if file.filename != "": @@ -56,7 +54,9 @@ def decode(): @app.route("/decoding", methods=['POST']) def decoding(): file = request.files['encoded_file'] - b2c = [int(request.form['b2c'])] + b2c = [int(x) for x in request.form.getlist("b2c")] + # b2c = [int(request.form['b2c'])] + print(b2c) if file.filename != "": file.save(WORKING_PATH + file.filename) payload = img_steg.img_steg(WORKING_PATH + file.filename, b2c).decode() diff --git a/Application/views/decode.html b/Application/views/decode.html index db8474c..bf4529f 100644 --- a/Application/views/decode.html +++ b/Application/views/decode.html @@ -66,8 +66,16 @@
Drag and drop an image here or click to browse
-
- + +
+ + + + + + + +
diff --git a/Application/views/encode.html b/Application/views/encode.html index 895a47d..5dd0426 100644 --- a/Application/views/encode.html +++ b/Application/views/encode.html @@ -69,7 +69,17 @@
- + +
+ + + + + + + + +