From b8609c9c6d1682014234634c170edf2e05f72397 Mon Sep 17 00:00:00 2001 From: norman-andrians Date: Sat, 23 Sep 2023 01:41:20 +0700 Subject: [PATCH] seperate path and image --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 0e1874d..1070866 100644 --- a/main.py +++ b/main.py @@ -12,11 +12,14 @@ from email.mime.image import MIMEImage app = Flask(__name__) +INPUT_IMG_PATH = "images/main/shannon.jpg" +OUTPUT_IMG_NAME = "black-man-wearing-suit.jpg" + def add_textimg(text, code): path = f"images/output/pos-{str(code)}.jpg" try: - img = Image.open("images/main/shannon.jpg") + img = Image.open(INPUT_IMG_PATH) draw = ImageDraw.Draw(img) font = ImageFont.truetype("fonts/impact.ttf", 24) @@ -106,7 +109,7 @@ if you're not the one doing this just ignore it""" # attach picure pict = add_textimg("Your verification code is", str(randis)) - zmail.attach(MIMEImage(pict, name="black-man-wearing-suit.jpg")) + zmail.attach(MIMEImage(pict, name=OUTPUT_IMG_NAME)) # creating context context = ssl.create_default_context()