fix: resize custom images

This commit is contained in:
trafficlunar 2026-03-30 13:54:20 +01:00
parent e078d59812
commit e47914f873
3 changed files with 3 additions and 3 deletions

View file

@ -163,7 +163,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
await Promise.all( await Promise.all(
images.map(async (image, index) => { images.map(async (image, index) => {
const buffer = Buffer.from(await image.arrayBuffer()); const buffer = Buffer.from(await image.arrayBuffer());
const pngBuffer = await sharp(buffer).png({ quality: 85 }).toBuffer(); const pngBuffer = await sharp(buffer).resize({ height: 800, fit: "inside", withoutEnlargement: true }).png({ quality: 85 }).toBuffer();
const fileLocation = path.join(miiUploadsDirectory, `image${index}.png`); const fileLocation = path.join(miiUploadsDirectory, `image${index}.png`);
await fs.writeFile(fileLocation, pngBuffer); await fs.writeFile(fileLocation, pngBuffer);

View file

@ -313,7 +313,7 @@ export async function POST(request: NextRequest) {
await Promise.all( await Promise.all(
customImages.map(async (image, index) => { customImages.map(async (image, index) => {
const buffer = Buffer.from(await image.arrayBuffer()); const buffer = Buffer.from(await image.arrayBuffer());
const pngBuffer = await sharp(buffer).png({ quality: 85 }).toBuffer(); const pngBuffer = await sharp(buffer).resize({ height: 800, fit: "inside", withoutEnlargement: true }).png({ quality: 85 }).toBuffer();
const fileLocation = path.join(miiUploadsDirectory, `image${index}.png`); const fileLocation = path.join(miiUploadsDirectory, `image${index}.png`);
await fs.writeFile(fileLocation, pngBuffer); await fs.writeFile(fileLocation, pngBuffer);

View file

@ -189,7 +189,7 @@ export default async function MiiList({ searchParams, userId, inLikesPage }: Pro
</div> </div>
</div> </div>
<MiiGrid miis={miis} /> <MiiGrid miis={miis} userId={userId} />
<Pagination lastPage={lastPage} /> <Pagination lastPage={lastPage} />
</div> </div>
); );