Removed preview quality from url query.

This commit is contained in:
Christian Bastian
2024-07-20 20:46:27 -04:00
parent 570a9b26ea
commit 534f93e242
2 changed files with 2 additions and 12 deletions

View File

@@ -293,11 +293,7 @@ def image_format_is_equal(f1, f2):
@server.PromptServer.instance.routes.get("/model-manager/preview/get") @server.PromptServer.instance.routes.get("/model-manager/preview/get")
async def get_model_preview(request): async def get_model_preview(request):
uri = request.query.get("uri") uri = request.query.get("uri")
quality = request.query.get("quality", "75") quality = 75
try:
quality = int(quality)
except:
quality = 75
response_image_format = request.query.get("image-format", None) response_image_format = request.query.get("image-format", None)
if isinstance(response_image_format, str): if isinstance(response_image_format, str):
response_image_format = response_image_format.upper() response_image_format = response_image_format.upper()

View File

@@ -115,10 +115,9 @@ class SearchPath {
* @param {string | undefined} [width=undefined] * @param {string | undefined} [width=undefined]
* @param {string | undefined} [height=undefined] * @param {string | undefined} [height=undefined]
* @param {string | undefined} [imageFormat=undefined] * @param {string | undefined} [imageFormat=undefined]
* @param {string | undefined} [quality=undefined]
* @returns {string} * @returns {string}
*/ */
function imageUri(imageSearchPath = undefined, dateImageModified = undefined, width = undefined, height = undefined, imageFormat = undefined, quality = undefined) { function imageUri(imageSearchPath = undefined, dateImageModified = undefined, width = undefined, height = undefined, imageFormat = undefined) {
const path = imageSearchPath ?? "no-preview"; const path = imageSearchPath ?? "no-preview";
const date = dateImageModified; const date = dateImageModified;
let uri = `/model-manager/preview/get?uri=${path}`; let uri = `/model-manager/preview/get?uri=${path}`;
@@ -134,16 +133,12 @@ function imageUri(imageSearchPath = undefined, dateImageModified = undefined, wi
if (imageFormat !== undefined && imageFormat !== null) { if (imageFormat !== undefined && imageFormat !== null) {
uri += `&image-format=${imageFormat}`; uri += `&image-format=${imageFormat}`;
} }
if (quality !== undefined && quality !== null) {
uri += `&quality=${quality}`;
}
return uri; return uri;
} }
const PREVIEW_NONE_URI = imageUri(); const PREVIEW_NONE_URI = imageUri();
const PREVIEW_THUMBNAIL_WIDTH = 320; const PREVIEW_THUMBNAIL_WIDTH = 320;
const PREVIEW_THUMBNAIL_HEIGHT = 480; const PREVIEW_THUMBNAIL_HEIGHT = 480;
const PREVIEW_THUMBNAIL_FORMAT = "JPEG"; const PREVIEW_THUMBNAIL_FORMAT = "JPEG";
const PREVIEW_THUMBNAIL_QUALITY = 75;
/** /**
* @param {(...args) => void} callback * @param {(...args) => void} callback
@@ -1712,7 +1707,6 @@ class ModelGrid {
PREVIEW_THUMBNAIL_WIDTH, PREVIEW_THUMBNAIL_WIDTH,
PREVIEW_THUMBNAIL_HEIGHT, PREVIEW_THUMBNAIL_HEIGHT,
PREVIEW_THUMBNAIL_FORMAT, PREVIEW_THUMBNAIL_FORMAT,
PREVIEW_THUMBNAIL_QUALITY,
), ),
draggable: false, draggable: false,
}), }),