File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
libraries/nestjs-libraries/src/integrations/social Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ async function reduceImageBySize(url: string, maxSizeKB = 976) {
5252 if ( width < 10 || height < 10 ) break ; // Prevent overly small dimensions
5353 }
5454
55- return imageBuffer ;
55+ return { width , height , buffer : imageBuffer } ;
5656 } catch ( error ) {
5757 console . error ( 'Error processing image:' , error ) ;
5858 throw error ;
@@ -259,9 +259,12 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
259259 // Upload images
260260 const images = await Promise . all (
261261 imageMedia . map ( async ( p ) => {
262- return await agent . uploadBlob (
263- new Blob ( [ await reduceImageBySize ( p . path ) ] )
264- ) ;
262+ const { buffer, width, height } = await reduceImageBySize ( p . path ) ;
263+ return {
264+ width,
265+ height,
266+ buffer : await agent . uploadBlob ( new Blob ( [ buffer ] ) ) ,
267+ } ;
265268 } )
266269 ) ;
267270
@@ -288,7 +291,11 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
288291 $type : 'app.bsky.embed.images' ,
289292 images : images . map ( ( p , index ) => ( {
290293 alt : imageMedia ?. [ index ] ?. alt || '' ,
291- image : p . data . blob ,
294+ image : p . buffer . data . blob ,
295+ aspectRatio : {
296+ width : p . width ,
297+ height : p . height ,
298+ }
292299 } ) ) ,
293300 } ;
294301 }
You can’t perform that action at this time.
0 commit comments