Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
canoypa committed Nov 28, 2024
1 parent ea3266b commit 2c05350
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/blurhash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ export async function getBlurhashDataUrlFromImage(
return await blurDataUrlFromImage(data)
}

if ('fsPath' in image.options.src) {
const buffer = await readFile(image.options.src.fsPath as string)
if ('src' in image.options.src) {
const filename = image.options.src.src
.replace(/^\/@fs/, '/')
.replace(/\?.+$/, '')

const imageFsPath = import.meta.env.PROD
? ['./dist', filename].join('')
: filename

const buffer = await readFile(imageFsPath)

return await blurDataUrlFromImage(buffer)
}

Expand Down

0 comments on commit 2c05350

Please sign in to comment.