Skip to content

Commit

Permalink
fix(path): vercel puts files from public/ into the root dir
Browse files Browse the repository at this point in the history
  • Loading branch information
bmschwartz committed Aug 11, 2024
1 parent b2f0873 commit c4c5759
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/api/watermark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {

// Read the file into a buffer
const imageFileBuffer = await fsPromises.readFile(originalImageFile.filepath);
const watermarkFileBuffer = await fsPromises.readFile('public/watermark.png');
let watermarkFileBuffer: Buffer;

try {
watermarkFileBuffer = await fsPromises.readFile('watermark.png');
} catch (error) {
watermarkFileBuffer = await fsPromises.readFile('public/watermark.png');
}

const watermarkedImage = await addImageWatermark(imageFileBuffer, watermarkFileBuffer, {
dpi: 600,
Expand Down

0 comments on commit c4c5759

Please sign in to comment.