mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-03-21 17:54:13 -05:00
Fix Bluesky image ratios
This commit is contained in:
parent
2743ca73bd
commit
47d15e8f7e
|
|
@ -37,13 +37,16 @@ export default class BlueskyClient extends Client
|
|||
let images = await Promise.all(
|
||||
status.media.map(async m => {
|
||||
// We have to convert the PNG to a JPG for Bluesky because of size limits
|
||||
let jpeg = await sharp(m.file).jpeg().toBuffer();
|
||||
let jpeg = sharp(m.file).jpeg();
|
||||
let metadata = await jpeg.metadata();
|
||||
let buffer = await jpeg.toBuffer();
|
||||
|
||||
let response = await this.#agent.uploadBlob(jpeg, { encoding: 'image/jpeg' });
|
||||
let response = await this.#agent.uploadBlob(buffer, { encoding: 'image/jpeg' });
|
||||
|
||||
return {
|
||||
image: response.data.blob,
|
||||
alt: m.altText || '',
|
||||
aspectRatio: { width: metadata.width, height: metadata.height },
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user