chore(deps): update faker to v7 (#957)

This commit is contained in:
Simon Lecoq
2022-06-25 03:52:30 +02:00
committed by GitHub
parent 3bcd3979a0
commit cd3d526301
19 changed files with 106 additions and 83 deletions

View File

@@ -330,7 +330,17 @@ export async function imgb64(image, {width, height, fallback = true} = {}) {
if (!image)
return fallback ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" : null
//Load image
image = await jimp.read(image)
try {
//Fix: redirections are not properly supported by jimp (https://github.com/oliver-moran/jimp/issues/909)
if (typeof image === "string") {
image = (await axios.get(image)).then(response => response.request.responseURL).catch(() => null)
console.debug(`metrics/svg/imgb64 > redirected image link to ${image}`)
}
image = await jimp.read(image)
}
catch {
return null
}
//Resize image
if ((width) && (height))
image = image.resize(width, height)