Using node. I want to upload some images to wordpress using the wordpress api. I tested and it works with png. Is this not possible with webp or maybe my code is wrong? I tried before with the UI and it works with webp.
This is the function
export async function testAddingMedia(league, teamAbbr1, teamAbbr2) {
/*
IMPORTANT PART OF generateFeaturedMedia
return await background
posite([
{ "input": team0LogoPath, "top": Math.round((metaBackground.height / 2) - (353)), "left": Math.round((metaBackground.width / 2) - 780) },
{
"input": team1LogoPath, "top": Math.round((metaBackground.height / 2) -
(353)), "left": Math.round((metaBackground.width / 2) + 195),
},
])
.webp()
.toBuffer(); */
const imageBuffer = await generateFeaturedMedia(
teamAbbr1, // this is used to find some images and join in a new img
teamAbbr2,
league
);
const filename = "someName"
const response = await fetch(apiMediaUrl, {
"method": 'POST',
"headers": {
'Content-Disposition': `attachment; filename="${filename}"`,
'Authorization': `Basic ${token}`, // this is defined outside
'Content-Type': 'image/webp',
},
"body": imageBuffer,
});
console.log("