fix: upload source for product lock mask edit
This commit is contained in:
parent
abfc813e42
commit
376881d9f9
@ -132,6 +132,7 @@ type ScaleAdjustPatchReference = {
|
||||
productLockOverlayUrl?: string | null;
|
||||
productLockProtectMaskUrl?: string | null;
|
||||
sourceCropUrl: string;
|
||||
sourceFullUrl?: string | null;
|
||||
structureLockedDraft?: boolean;
|
||||
targetDraftFullUrl?: string | null;
|
||||
targetDraftUrl: string;
|
||||
@ -3819,6 +3820,7 @@ async function createScaleAdjustPatchReference(params: {
|
||||
const suffix = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
||||
if (params.fullFrameReferenceOnly && structureLockAppliedRef.value) {
|
||||
const [
|
||||
sourceFullUpload,
|
||||
targetDraftFullUpload,
|
||||
backgroundPlateFullUpload,
|
||||
productLockOverlayUpload,
|
||||
@ -3827,6 +3829,15 @@ async function createScaleAdjustPatchReference(params: {
|
||||
productLockEditMaskUpload,
|
||||
productLockFalEditMaskUpload,
|
||||
] = await Promise.all([
|
||||
sharp(sourceBuffer, { failOn: "none" })
|
||||
.png({ compressionLevel: 6 })
|
||||
.toBuffer()
|
||||
.then((sourceFullBuffer) =>
|
||||
uploadFile(
|
||||
`canvas-scale-adjust-source-full-${suffix}.png`,
|
||||
toArrayBuffer(sourceFullBuffer)
|
||||
)
|
||||
),
|
||||
uploadFile(
|
||||
`canvas-scale-adjust-full-target-draft-${suffix}.png`,
|
||||
toArrayBuffer(targetDraftBuffer)
|
||||
@ -3878,6 +3889,7 @@ async function createScaleAdjustPatchReference(params: {
|
||||
productLockOverlayUrl: productLockOverlayUpload?.url || null,
|
||||
productLockProtectMaskUrl: productLockProtectMaskUpload?.url || null,
|
||||
sourceCropUrl: sourceImageUrl || targetDraftFullUpload.url,
|
||||
sourceFullUrl: sourceFullUpload.url,
|
||||
structureLockedDraft: structureLockAppliedRef.value,
|
||||
targetDraftFullUrl: targetDraftFullUpload.url,
|
||||
targetDraftUrl: targetDraftFullUpload.url,
|
||||
@ -5436,7 +5448,7 @@ export async function POST(request: NextRequest) {
|
||||
? useScaleAdjustProductLockComposite
|
||||
? useScaleAdjustProductLockMaskEdit
|
||||
? [
|
||||
sourceImageUrl,
|
||||
scaleAdjustPatchReference.sourceFullUrl || sourceImageUrl,
|
||||
...scaleAdjustCropReferenceImageUrls,
|
||||
...manualRegionReferenceImageUrls,
|
||||
]
|
||||
@ -5605,6 +5617,8 @@ export async function POST(request: NextRequest) {
|
||||
: null,
|
||||
scaleAdjustPatchSourceCropUrl:
|
||||
scaleAdjustPatchReference?.sourceCropUrl || null,
|
||||
scaleAdjustPatchSourceFullUrl:
|
||||
scaleAdjustPatchReference?.sourceFullUrl || null,
|
||||
scaleAdjustPatchTargetDraftUrl:
|
||||
scaleAdjustPatchReference?.targetDraftUrl || null,
|
||||
scaleAdjustPatchTargetDraftFullUrl:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user