fdfd
parent
b3fa1af292
commit
f326c7a440
|
@ -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']
|
||||
|
|
|
@ -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.")
|
||||
|
|
Loading…
Reference in New Issue