fix: png files are not transformed

This commit is contained in:
log101 2024-02-22 17:31:55 +03:00
parent 83ebdcbf21
commit 4f2cdaa302

View File

@ -42,12 +42,14 @@ export const POST: APIRoute = async ({ request }) => {
const imageBuf = await image.arrayBuffer() const imageBuf = await image.arrayBuffer()
const { data } = await sharpService.transform( const { data, format } = await sharpService.transform(
new Uint8Array(imageBuf), new Uint8Array(imageBuf),
{ src: imageName }, { src: imageName, format: "webp" },
{ domains: [], remotePatterns: [], service: { entrypoint: "", config: { limitInputPixels: false } } } { domains: [], remotePatterns: [], service: { entrypoint: "", config: { limitInputPixels: false } } }
) )
console.log(format)
const { error } = await supabase.storage.from("images").upload(`public/${imageName}`, data, { const { error } = await supabase.storage.from("images").upload(`public/${imageName}`, data, {
cacheControl: "3600", cacheControl: "3600",
upsert: false, upsert: false,