mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
refactor: Replace hardcoded image width with CARD_PREVIEW_WIDTH constant for consistency
This commit is contained in:
@@ -9,6 +9,7 @@ import asyncio
|
|||||||
from ..utils.exif_utils import ExifUtils
|
from ..utils.exif_utils import ExifUtils
|
||||||
from ..utils.recipe_parsers import RecipeParserFactory
|
from ..utils.recipe_parsers import RecipeParserFactory
|
||||||
from ..services.civitai_client import CivitaiClient
|
from ..services.civitai_client import CivitaiClient
|
||||||
|
from ..utils.constants import CARD_PREVIEW_WIDTH
|
||||||
|
|
||||||
from ..services.recipe_scanner import RecipeScanner
|
from ..services.recipe_scanner import RecipeScanner
|
||||||
from ..services.lora_scanner import LoraScanner
|
from ..services.lora_scanner import LoraScanner
|
||||||
@@ -424,7 +425,7 @@ class RecipeRoutes:
|
|||||||
# Optimize the image (resize and convert to WebP)
|
# Optimize the image (resize and convert to WebP)
|
||||||
optimized_image, extension = ExifUtils.optimize_image(
|
optimized_image, extension = ExifUtils.optimize_image(
|
||||||
image_data=image,
|
image_data=image,
|
||||||
target_width=480,
|
target_width=CARD_PREVIEW_WIDTH,
|
||||||
format='webp',
|
format='webp',
|
||||||
quality=85,
|
quality=85,
|
||||||
preserve_metadata=True
|
preserve_metadata=True
|
||||||
@@ -828,7 +829,7 @@ class RecipeRoutes:
|
|||||||
# Optimize the image (resize and convert to WebP)
|
# Optimize the image (resize and convert to WebP)
|
||||||
optimized_image, extension = ExifUtils.optimize_image(
|
optimized_image, extension = ExifUtils.optimize_image(
|
||||||
image_data=image,
|
image_data=image,
|
||||||
target_width=480,
|
target_width=CARD_PREVIEW_WIDTH,
|
||||||
format='webp',
|
format='webp',
|
||||||
quality=85,
|
quality=85,
|
||||||
preserve_metadata=True
|
preserve_metadata=True
|
||||||
|
|||||||
@@ -7,16 +7,19 @@ NSFW_LEVELS = {
|
|||||||
"Blocked": 32, # Probably not actually visible through the API without being logged in on model owner account?
|
"Blocked": 32, # Probably not actually visible through the API without being logged in on model owner account?
|
||||||
}
|
}
|
||||||
|
|
||||||
# 预览文件扩展名
|
# preview extensions
|
||||||
PREVIEW_EXTENSIONS = [
|
PREVIEW_EXTENSIONS = [
|
||||||
|
'.webp',
|
||||||
|
'.preview.webp',
|
||||||
'.preview.png',
|
'.preview.png',
|
||||||
'.preview.jpeg',
|
'.preview.jpeg',
|
||||||
'.preview.jpg',
|
'.preview.jpg',
|
||||||
'.preview.webp',
|
|
||||||
'.preview.mp4',
|
'.preview.mp4',
|
||||||
'.png',
|
'.png',
|
||||||
'.jpeg',
|
'.jpeg',
|
||||||
'.jpg',
|
'.jpg',
|
||||||
'.webp',
|
|
||||||
'.mp4'
|
'.mp4'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Card preview image width
|
||||||
|
CARD_PREVIEW_WIDTH = 480
|
||||||
Reference in New Issue
Block a user