diff --git a/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts b/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts index c90990fb..621549ad 100644 --- a/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts @@ -52,7 +52,7 @@ async function reduceImageBySize(url: string, maxSizeKB = 976) { if (width < 10 || height < 10) break; // Prevent overly small dimensions } - return imageBuffer; + return { width, height, buffer: imageBuffer }; } catch (error) { console.error('Error processing image:', error); throw error; @@ -259,9 +259,12 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider { // Upload images const images = await Promise.all( imageMedia.map(async (p) => { - return await agent.uploadBlob( - new Blob([await reduceImageBySize(p.path)]) - ); + const { buffer, width, height } = await reduceImageBySize(p.path); + return { + width, + height, + buffer: await agent.uploadBlob(new Blob([buffer])), + }; }) ); @@ -288,7 +291,11 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider { $type: 'app.bsky.embed.images', images: images.map((p, index) => ({ alt: imageMedia?.[index]?.alt || '', - image: p.data.blob, + image: p.buffer.data.blob, + aspectRatio: { + width: p.width, + height: p.height, + } })), }; }