diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index 9fb196d3a..188ab3cab 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -281,10 +281,12 @@ async def update_rom( file_location_s = f"{artwork_path}/small.{file_ext}" with open(file_location_s, "wb+") as artwork_s: artwork_s.write(artwork_file) + fs_resource_handler.resize_cover(file_location_s) file_location_l = f"{artwork_path}/big.{file_ext}" with open(file_location_l, "wb+") as artwork_l: artwork_l.write(artwork_file) + fs_resource_handler.resize_cover(file_location_l) db_rom_handler.update_rom(id, cleaned_data) diff --git a/backend/handler/fs_handler/fs_resources_handler.py b/backend/handler/fs_handler/fs_resources_handler.py index 240313e82..cf83e3e5e 100644 --- a/backend/handler/fs_handler/fs_resources_handler.py +++ b/backend/handler/fs_handler/fs_resources_handler.py @@ -45,7 +45,7 @@ class FSResourceHandler(FSHandler): ) @staticmethod - def _resize_cover(cover_path: str, size: CoverSize) -> None: + def resize_cover(cover_path: str, size: CoverSize = CoverSize.BIG) -> None: """Resizes the cover image to the standard size Args: @@ -97,7 +97,7 @@ class FSResourceHandler(FSHandler): Path(cover_path).mkdir(parents=True, exist_ok=True) with open(f"{cover_path}/{cover_file}", "wb") as f: shutil.copyfileobj(res.raw, f) - self._resize_cover(f"{cover_path}/{cover_file}", size) + self.resize_cover(f"{cover_path}/{cover_file}", size) @staticmethod def _get_cover_path(fs_slug: str, rom_name: str, size: CoverSize):