mirror of
https://github.com/misenhower/splatoon2.ink.git
synced 2026-04-26 17:38:29 -05:00
Fix Bluesky image ratios
This commit is contained in:
parent
73aadd0c0a
commit
3d6ac63152
|
|
@ -36,13 +36,16 @@ class BlueskyClient
|
||||||
let images = await Promise.all(
|
let images = await Promise.all(
|
||||||
status.media.map(async m => {
|
status.media.map(async m => {
|
||||||
// We have to convert the PNG to a JPG for Bluesky because of size limits
|
// 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 {
|
return {
|
||||||
image: response.data.blob,
|
image: response.data.blob,
|
||||||
alt: m.altText || '',
|
alt: m.altText || '',
|
||||||
|
aspectRatio: { width: metadata.width, height: metadata.height },
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user