Fixed artefact images in warehouse EditModal

This commit is contained in:
Tim Howitz 2025-06-06 19:42:41 +01:00
parent 5024ad4324
commit b750c5fd74
3 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ export async function POST(request: NextRequest) {
const buffer = Buffer.from(await image.arrayBuffer());
const extension = image.type === "image/jpeg" ? "jpg" : "png";
imageName = `${name || artefact.name}-${new Date().toLocaleDateString("en-GB")}.${extension}`;
const imagePath = join(process.cwd(), "public", imageName);
const imagePath = join(process.cwd(), "public", "artefactImages", imageName);
await writeFile(imagePath, buffer);
}

View File

@ -53,7 +53,7 @@ export async function POST(request: NextRequest) {
const buffer = Buffer.from(await image.arrayBuffer());
const extension = image.type === "image/jpeg" ? "jpg" : "png";
imageName = `${name}-${new Date().toLocaleDateString("en-GB")}.${extension}`;
const imagePath = join(process.cwd(), "public", imageName);
const imagePath = join(process.cwd(), "public", "artefactImages", imageName);
await writeFile(imagePath, buffer);
}

View File

@ -447,11 +447,11 @@ function EditModal({ artefact, onClose }: { artefact: ExtendedArtefact; onClose:
{artefact.imageName && (
<div className="mb-2">
<Image
src={`/uploads/${artefact.imageName}`}
src={`/artefactImages/${artefact.imageName || "NoImageFound.PNG"}`}
alt="Artefact"
width={200}
height={200}
className="object-cover rounded-md"
className="object-cover mx-auto rounded-md"
/>
</div>
)}