gf
This commit is contained in:
parent
eca55ec0ce
commit
56686623c7
1 changed files with 10 additions and 6 deletions
|
@ -518,12 +518,16 @@ def thumbs(new_post):
|
||||||
print(f'Unknown content type {x.headers.get("Content-Type")}')
|
print(f'Unknown content type {x.headers.get("Content-Type")}')
|
||||||
return False, f'Unknown content type {x.headers.get("Content-Type")} for submitted content'
|
return False, f'Unknown content type {x.headers.get("Content-Type")} for submitted content'
|
||||||
|
|
||||||
with open("image.webp", "wb") as file:
|
if 'pcmemes.net' in request.host:
|
||||||
for chunk in image_req.iter_content(1024):
|
with open("image.webp", "wb") as file:
|
||||||
file.write(chunk)
|
for chunk in image_req.iter_content(1024):
|
||||||
|
file.write(chunk)
|
||||||
if 'pcmemes.net' in request.host: post.thumburl = upload_ibb(resize=True)
|
post.thumburl = upload_ibb(resize=True)
|
||||||
else: post.thumburl = upload_imgur(filepath="image.webp", resize=True)
|
else:
|
||||||
|
with open("image.png", "wb") as file:
|
||||||
|
for chunk in image_req.iter_content(1024):
|
||||||
|
file.write(chunk)
|
||||||
|
post.thumburl = upload_imgur(filepath="image.png", resize=True)
|
||||||
|
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue