Skip to content

Commit

Permalink
Merge pull request #74 from openstreetmap-polska/dev
Browse files Browse the repository at this point in the history
Release to main
  • Loading branch information
Zaczero authored Apr 5, 2024
2 parents b5c8fdd + 8b54c8f commit 83763f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ services:
"*",
]

shm_size: '2gb'

ports:
- ${LISTEN:-80}:8000

Expand Down
12 changes: 5 additions & 7 deletions services/photo_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,19 @@ async def get_by_id(id: str, *, check_file: bool = True) -> Photo | None:
@staticmethod
@trace
async def upload(node_id: int, user_id: int, file: UploadFile) -> Photo:
photo = Photo(
node_id=node_id,
user_id=user_id,
)

img = Image.open(file.file)
img = ImageOps.exif_transpose(img)
img = _resize_image(img)
img_bytes = _optimize_quality(img)

await photo.file_path.write_bytes(img_bytes)

async with db_write() as session:
photo = Photo(
node_id=node_id,
user_id=user_id,
)
session.add(photo)

await photo.file_path.write_bytes(img_bytes)
return photo


Expand Down

0 comments on commit 83763f6

Please sign in to comment.