mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 23:06:11 +00:00
fixed custom cover resize
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user