fix: upload normalized source for fal scale edit
This commit is contained in:
parent
ff71e3935c
commit
3aa031a4e4
@ -3984,6 +3984,15 @@ async function createScaleAdjustPatchReference(params: {
|
|||||||
return uploadScaleAdjustPrepAsset(filename, buffer);
|
return uploadScaleAdjustPrepAsset(filename, buffer);
|
||||||
};
|
};
|
||||||
if (params.fullFrameReferenceOnly && structureLockAppliedRef.value) {
|
if (params.fullFrameReferenceOnly && structureLockAppliedRef.value) {
|
||||||
|
const sourceFullUploadBuffer = await sharp(sourceBuffer, { failOn: "none" })
|
||||||
|
.rotate()
|
||||||
|
.flatten({ background: "#ffffff" })
|
||||||
|
.jpeg({ quality: 94, mozjpeg: true })
|
||||||
|
.toBuffer();
|
||||||
|
const sourceFullUpload = await uploadScaleAdjustPrepAsset(
|
||||||
|
`canvas-scale-adjust-full-source-${suffix}.jpg`,
|
||||||
|
sourceFullUploadBuffer
|
||||||
|
);
|
||||||
const targetDraftFullUpload = await uploadScaleAdjustPrepAsset(
|
const targetDraftFullUpload = await uploadScaleAdjustPrepAsset(
|
||||||
`canvas-scale-adjust-full-target-draft-${suffix}.jpg`,
|
`canvas-scale-adjust-full-target-draft-${suffix}.jpg`,
|
||||||
targetDraftUploadBuffer
|
targetDraftUploadBuffer
|
||||||
@ -4042,7 +4051,7 @@ async function createScaleAdjustPatchReference(params: {
|
|||||||
productLockFalEditMaskUrl: productLockFalEditMaskUpload?.url || null,
|
productLockFalEditMaskUrl: productLockFalEditMaskUpload?.url || null,
|
||||||
productLockOverlayUrl: productLockOverlayUpload?.url || null,
|
productLockOverlayUrl: productLockOverlayUpload?.url || null,
|
||||||
productLockProtectMaskUrl: productLockProtectMaskUpload?.url || null,
|
productLockProtectMaskUrl: productLockProtectMaskUpload?.url || null,
|
||||||
sourceCropUrl: sourceImageUrl || fullFrameFallbackUrl,
|
sourceCropUrl: sourceFullUpload?.url || sourceImageUrl || fullFrameFallbackUrl,
|
||||||
structureLockedDraft: structureLockAppliedRef.value,
|
structureLockedDraft: structureLockAppliedRef.value,
|
||||||
targetDraftFullUrl: fullFrameFallbackUrl,
|
targetDraftFullUrl: fullFrameFallbackUrl,
|
||||||
targetDraftUrl: fullFrameFallbackUrl,
|
targetDraftUrl: fullFrameFallbackUrl,
|
||||||
@ -5695,12 +5704,12 @@ export async function POST(request: NextRequest) {
|
|||||||
? useScaleAdjustProductLockComposite
|
? useScaleAdjustProductLockComposite
|
||||||
? useScaleAdjustProductLockMaskEdit
|
? useScaleAdjustProductLockMaskEdit
|
||||||
? [
|
? [
|
||||||
sourceImageUrl,
|
scaleAdjustPatchReference.sourceCropUrl,
|
||||||
...scaleAdjustCropReferenceImageUrls,
|
...scaleAdjustCropReferenceImageUrls,
|
||||||
...manualRegionReferenceImageUrls,
|
...manualRegionReferenceImageUrls,
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
sourceImageUrl,
|
scaleAdjustPatchReference.sourceCropUrl,
|
||||||
scaleAdjustPatchReference.backgroundPlateFullUrl as string,
|
scaleAdjustPatchReference.backgroundPlateFullUrl as string,
|
||||||
...scaleAdjustCropReferenceImageUrls,
|
...scaleAdjustCropReferenceImageUrls,
|
||||||
...manualRegionReferenceImageUrls,
|
...manualRegionReferenceImageUrls,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user