liamfiddler / eleventy-plugin-lazyimages

Eleventy plugin that adds blurry placeholders & lazy loading to your images
MIT License
139 stars 29 forks source link

Error: Could not find MIME for Buffer <null> #26

Closed WebShapedBiz closed 4 years ago

WebShapedBiz commented 4 years ago

Hi.

I found this plugin while playing with a very nice Ghost 11ty starter project at https://github.com/TryGhost/eleventy-starter-ghost

Basically everything works out of the box, except for a few styling glitches, but for every image that LazyImages handles, while the image is rendered correctly, I'm getting this error:

LazyImages https://static.ghost.org/v3.0.0/images/ghost.png Error: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (/home/myfolder/Dev/ghost-11ty/11ty/node_modules/@jimp/core/dist/utils/image-bitmap.js:187:15)
    at Jimp.parseBitmap (/home/myfolder/Dev/ghost-11ty/11ty/node_modules/@jimp/core/dist/index.js:431:32)
    at /home/myfolder/Dev/ghost-11ty/11ty/node_modules/@jimp/core/dist/index.js:373:15
    at /home/myfolder/Dev/ghost-11ty/11ty/node_modules/@jimp/core/dist/index.js:115:14
    at /home/myfolder/Dev/ghost-11ty/11ty/node_modules/@jimp/core/dist/request.js:48:9
    at IncomingMessage.<anonymous> (/home/myfolder/Dev/ghost-11ty/11ty/node_modules/phin/lib/phin.compiled.js:1:2100)
    at IncomingMessage.emit (events.js:323:22)
    at endReadableNT (_stream_readable.js:1204:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  methodName: 'constructor'
}

Thank you for putting together this nice plugin.

Cheers.

liamfiddler commented 4 years ago

Hi @WebShapedBiz 👋

I've run into this issue as well. I started tracking it down and believe it's something to do with Cloudflare (the CDN Ghost uses) sending bot challenge HTML instead of the images. I didn't solve the issue.

However I'm very close to releasing v2.0.0 of this plugin and I believe the issue has been resolved there - could you please try it and let me know?

You can install a preview of v2.0.0 using the following command:

npm install liamfiddler/eleventy-plugin-lazyimages#sharp --save
WebShapedBiz commented 4 years ago

Thank you very much @liamfiddler for your time and effort, I'll try the preview and report it back.

Cheers.

WebShapedBiz commented 4 years ago

Not only that the preview works, but now I can actually see the home page images lazy loading. Previously they just have appeared but now there is a very visible lazy loading effect, previously missing.

Thank you again @liamfiddler

liamfiddler commented 4 years ago

v2 has just been released and resolves this issue 🎉