thrimbletrimmer: Load uploaded template in crop tool when type = ONEOFF

pull/480/head
Mike Lang 2 weeks ago
parent 87b27582c4
commit 3d22afbf0d

@ -282,7 +282,6 @@ window.addEventListener("DOMContentLoaded", async (event) => {
addError("Couldn't preview thumbnail; couldn't parse thumbnail frame timestamp"); addError("Couldn't preview thumbnail; couldn't parse thumbnail frame timestamp");
return; return;
} }
const imageTemplate = document.getElementById("video-info-thumbnail-template").value;
const videoFrameQuery = new URLSearchParams({ const videoFrameQuery = new URLSearchParams({
timestamp: imageTime, timestamp: imageTime,
}); });
@ -293,7 +292,16 @@ window.addEventListener("DOMContentLoaded", async (event) => {
"video-info-thumbnail-template-overlay-image", "video-info-thumbnail-template-overlay-image",
); );
const thumbnailMode = document.getElementById("video-info-thumbnail-mode").value;
if (thumbnailMode === "TEMPLATE") {
const imageTemplate = document.getElementById("video-info-thumbnail-template").value;
templateImageElement.src = `/thrimshim/template/${imageTemplate}.png`; templateImageElement.src = `/thrimshim/template/${imageTemplate}.png`;
} else if (thumbnailMode === "ONEOFF") {
const templateData = await uploadedImageToBase64();
templateImageElement.src = `data:image/png;base64,${templateData}`;
} else {
console.log(`WARNING: Source images updated but thumbnailMode = ${thumbnailMode}`);
}
templateImageElement.classList.remove("hidden"); templateImageElement.classList.remove("hidden");
const aspectRatioControls = document.getElementById( const aspectRatioControls = document.getElementById(

Loading…
Cancel
Save