remotes/1693045480750635534/spooky-22
Aevann1 2021-07-30 11:15:36 +02:00
parent b3fa1af292
commit f326c7a440
2 changed files with 3 additions and 6 deletions

View File

@ -39,7 +39,6 @@ def upload_file(file, resize=None):
img = io.BytesIO()
i.save(img, format='GIF')
req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {imgurkey}"}, data = {'image': base64.b64encode(img.getvalue())})
remove(filename)
try: resp = req.json()['data']
except Exception as e:
print(req.text)
@ -72,7 +71,6 @@ def upload_from_file(filename, resize=None):
img = io.BytesIO()
i.save(img, format='GIF')
req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {imgurkey}"}, data = {'image': base64.b64encode(img.getvalue())})
remove(filename)
try:
resp = req.json()['data']

View File

@ -328,11 +328,10 @@ def settings_images_profile(v):
g.db.rollback()
abort(413)
imageurl = upload_file(request.files["profile"])
highres = upload_file(request.files["profile"])
print(highres)
imageurl = upload_file(request.files["profile"], (100,100))
print(imageurl)
if imageurl:
v.profileurl = imageurl
g.db.add(v)
return render_template("settings_profile.html",
v=v, msg="Profile picture successfully updated.")