mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-24 23:05:05 +00:00
fix: optimize photo processing in generateOGImage function
- Changed the iteration logic to process photos in reverse order, improving the handling of the latest photos. - Introduced a variable to store the minimum length for cleaner and more readable code. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -263,7 +263,8 @@ export async function generateOGImage(options: OGImageOptions) {
|
||||
{ x: 270, y: 70 },
|
||||
]
|
||||
|
||||
for (let i = 0; i < Math.min(latestPhotos.length, photoCount); i++) {
|
||||
const length = Math.min(latestPhotos.length, photoCount)
|
||||
for (let i = length - 1; i >= 0; i--) {
|
||||
const photo = latestPhotos[i]
|
||||
const thumbnailBuffer = await downloadAndProcessThumbnail(
|
||||
photo.thumbnailUrl,
|
||||
|
||||
Reference in New Issue
Block a user