fdfd
This commit is contained in:
parent
6baa89d148
commit
b6ebc318f7
2 changed files with 7 additions and 4 deletions
|
@ -39,7 +39,9 @@ def upload_file(file=None, resize=False, png=False):
|
|||
data={'image': base64.b64encode(f.read())}
|
||||
req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}, data=data)
|
||||
resp = req.json()['data']
|
||||
url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
url = resp['link']
|
||||
if not "_d" in url:
|
||||
url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "_d." in url: url += "?maxwidth=9999"
|
||||
except: return
|
||||
|
||||
|
|
|
@ -520,7 +520,8 @@ def submit_post(v):
|
|||
if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"):
|
||||
url = url.replace("https://streamable.com/", "https://streamable.com/e/")
|
||||
|
||||
if "i.imgur.com" in url: url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "i.imgur.com" in url and "_d" not in url:
|
||||
url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "_d." in url: url += "?maxwidth=9999"
|
||||
|
||||
repost = g.db.query(Submission).join(Submission.submission_aux).filter(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue