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) {
52
52
if ( width < 10 || height < 10 ) break ; // Prevent overly small dimensions
53
53
}
54
54
55
- return imageBuffer ;
55
+ return { width , height , buffer : imageBuffer } ;
56
56
} catch ( error ) {
57
57
console . error ( 'Error processing image:' , error ) ;
58
58
throw error ;
@@ -259,9 +259,12 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
259
259
// Upload images
260
260
const images = await Promise . all (
261
261
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
+ } ;
265
268
} )
266
269
) ;
267
270
@@ -288,7 +291,11 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
288
291
$type : 'app.bsky.embed.images' ,
289
292
images : images . map ( ( p , index ) => ( {
290
293
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
+ }
292
299
} ) ) ,
293
300
} ;
294
301
}
You can’t perform that action at this time.
0 commit comments