diff --git a/files/helpers/images.py b/files/helpers/images.py
index 990c2872b..ff5f9e4b9 100644
--- a/files/helpers/images.py
+++ b/files/helpers/images.py
@@ -4,9 +4,10 @@ import time
def process_image(file=None, filename=None, resize=0):
- i = IImage.open(file)
if not filename: filename = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
+ i = IImage.open(file)
+
if resize:
size = resize, resize
frames = ImageSequence.Iterator(i)
@@ -24,7 +25,7 @@ def process_image(file=None, filename=None, resize=0):
om.save(filename, format="WEBP", save_all=True, append_images=list(frames), loop=0, method=6, allow_mixed=True)
elif i.format.lower() != "webp":
if i.format.lower() == "gif":
- i.save(filename)
+ file.save(filename)
gifwebp(input_image=filename, output_image=filename, option="-mixed -metadata none -f 100 -mt -m 6")
else: i.save(filename, format="WEBP", method=6)
diff --git a/files/routes/comments.py b/files/routes/comments.py
index d77cdea89..99a036a32 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -174,14 +174,14 @@ def api_comment(v):
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file"]
if file.content_type.startswith('image/'):
- body += f"\n\n})"
+ body += f"\n\n})"
if v.admin_level == 3:
if parent_post.id == 37696:
filename = 'files/assets/images/Drama/sidebar/' + str(len(listdir('files/assets/images/Drama/sidebar'))+1) + '.webp'
- text = process_image(file.stream, filename, 400)
+ text = process_image(file, filename, 400)
elif parent_post.id == 37697:
filename = 'files/assets/images/Drama/sidebar/' + str(len(listdir('files/assets/images/Drama/banners'))+1) + '.webp'
- process_image(file.stream, filename)
+ process_image(file, filename)
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
@@ -639,7 +639,7 @@ def edit_comment(cid, v):
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file"]
if file.content_type.startswith('image/'):
- body += f"\n\n})"
+ body += f"\n\n})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 23a87efe8..6ebf90a5b 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -419,7 +419,7 @@ def edit_post(pid, v):
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file"]
if file.content_type.startswith('image/'):
- body += f"\n\n})"
+ body += f"\n\n})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
@@ -848,7 +848,7 @@ def submit_post(v):
if request.files.get("file2") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file2"]
if file.content_type.startswith('image/'):
- body += f"\n\n})"
+ body += f"\n\n})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
@@ -935,8 +935,8 @@ def submit_post(v):
file = request.files['file']
if file.content_type.startswith('image/'):
- new_post.url = process_image(file.stream)
- new_post.thumburl = process_image(file.stream, resize=100)
+ new_post.url = process_image(file)
+ new_post.thumburl = process_image(file, resize=100)
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
diff --git a/files/routes/settings.py b/files/routes/settings.py
index 6983290a9..04ac3f6b4 100644
--- a/files/routes/settings.py
+++ b/files/routes/settings.py
@@ -255,7 +255,7 @@ def settings_profile_post(v):
if request.files.get('file'):
file = request.files['file']
if file.content_type.startswith('image/'):
- bio += f"\n\n})"
+ bio += f"\n\n})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
@@ -621,11 +621,11 @@ def settings_images_profile(v):
file = request.files["profile"]
- highres = process_image(file.stream)
+ highres = process_image(file)
if not highres: abort(400)
- imageurl = process_image(file.stream, resize=100)
+ imageurl = process_image(file, resize=100)
if not imageurl: abort(400)
@@ -652,7 +652,7 @@ def settings_images_banner(v):
file = request.files["banner"]
- bannerurl = process_image(file.stream)
+ bannerurl = process_image(file)
if bannerurl:
if v.bannerurl and '/images/' in v.bannerurl : os.remove('/images/' + v.bannerurl.split('/images/')[1])
diff --git a/files/routes/static.py b/files/routes/static.py
index c50e022b0..879a1a7f8 100644
--- a/files/routes/static.py
+++ b/files/routes/static.py
@@ -271,7 +271,7 @@ def submit_contact(v):
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file"]
if file.content_type.startswith('image/'):
- body_html += f''
+ body_html += f''
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f: