next-blurhash-previews 0.0.3-beta27 → 0.0.3-beta28

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,11 +21,17 @@ export async function getBlurhash(path) {
21
21
  const blurhashImage = await getSharpImage(path);
22
22
  const dimensions = await blurhashImage.metadata();
23
23
 
24
- const { width, height } = dimensions;
24
+ let { width, height } = dimensions;
25
+
26
+ if (width > 200) {
27
+ let newMetadata = await blurhashImage.resize(200).metadata();
28
+ width = newMetadata.width;
29
+ height = newMetadata.height;
30
+ }
25
31
 
26
32
  return new Promise((res, rej) => {
27
33
  blurhashImage
28
- .resize(Math.min(width, 200))
34
+ .resize(Math.min(width))
29
35
  .raw()
30
36
  .ensureAlpha()
31
37
  .toBuffer((err, buffer) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-blurhash-previews",
3
- "version": "0.0.3-beta27",
3
+ "version": "0.0.3-beta28",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",