Изменил url аватарки
This commit is contained in:
parent
cae2599414
commit
d06e153a51
1 changed files with 3 additions and 2 deletions
|
@ -40,9 +40,10 @@ app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
||||||
@app.post('/images', response_model=dict[str, str])
|
@app.post('/images', response_model=dict[str, str])
|
||||||
async def upload_images(file: UploadFile):
|
async def upload_images(file: UploadFile):
|
||||||
name = generate_random_string()
|
name = generate_random_string()
|
||||||
with open(f'app/static/images/{name}.webp', 'wb+') as file_object:
|
image_url = f'app/static/images/{name}_avatar.png'
|
||||||
|
with open(image_url, 'wb+') as file_object:
|
||||||
shutil.copyfileobj(file.file, file_object)
|
shutil.copyfileobj(file.file, file_object)
|
||||||
return {'name': name}
|
return {'image_url': image_url}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue