Skip to content

Commit

Permalink
Add missing fallback for missing Jimp dependencies (#2257)
Browse files Browse the repository at this point in the history
* Add missing fallback for missing Jimp dependencies

* lint
  • Loading branch information
soulgalore authored Jan 21, 2025
1 parent 005e6fd commit 046c67f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/support/images/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import path from 'node:path';
import { pathToFolder } from '../pathToFolder.js';
import { loadCustomJimp } from '../../screenshot/loadCustomJimp.js';
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime');

export async function savePngWithoutResize(
name,
data,
Expand Down Expand Up @@ -38,6 +41,11 @@ export async function savePng(
buffer,
path.join(pathToFolder(url, options), dir)
);
} else {
log.info(
'Missing Jimp dependency so you can only save images as png at viewport size'
);
return savePngWithoutResize(name, data, url, storageManager, dir, options);
}
}
export async function saveJpg(
Expand All @@ -63,5 +71,10 @@ export async function saveJpg(
buffer,
path.join(pathToFolder(url, options), dir)
);
} else {
log.info(
'Missing Jimp dependency so you can only save images as png at viewport size'
);
return savePngWithoutResize(name, data, url, storageManager, dir, options);
}
}

0 comments on commit 046c67f

Please sign in to comment.