Skip to content

feat(imgix): format keys#364

Merged
pi0 merged 2 commits into
nuxt:mainfrom
shadow81627:feat/imgix-blurhash
Sep 5, 2021
Merged

feat(imgix): format keys#364
pi0 merged 2 commits into
nuxt:mainfrom
shadow81627:feat/imgix-blurhash

Conversation

@shadow81627

Copy link
Copy Markdown
Contributor

resolves #363

@productdevbook

Copy link
Copy Markdown
Member

blurhash library used ? I couldn't see https://github.com/nuxt/image/blob/main/package.json

@shadow81627

shadow81627 commented Jul 9, 2021

Copy link
Copy Markdown
Contributor Author

@productfrontenddeveloper my understanding is that blurhash is a image format supported by imgix?
https://docs.imgix.com/apis/rendering/format/fm#blurhash

What is the library we need to include and what functionality does it provide?

@productdevbook

productdevbook commented Jul 9, 2021

Copy link
Copy Markdown
Member

imgix return blurhash -> 'eEC|aSROj=WAt:f-n#WXe-N4bJtRj]j[M{oNkXj[ozRjj^a$ayfl' and see loading etc with.

https://blog.imgix.com/2021/01/26/blurhash

https://blurha.sh/

https://github.com/woltapp/blurhash/tree/master/TypeScript

@shadow81627

Copy link
Copy Markdown
Contributor Author

@pi0 is it in scope for @nuxt/image to transform blurhash into placeholder images? https://github.com/woltapp/blurhash/tree/master/TypeScript

@pi0 pi0 merged commit ce66fa7 into nuxt:main Sep 5, 2021
@pi0

pi0 commented Sep 5, 2021

Copy link
Copy Markdown
Member

Thanks!

is it in scope for @nuxt/image to transform blurhash into placeholder images?

Nop. It happens on server side of imgix

@productdevbook

productdevbook commented Sep 6, 2021

Copy link
Copy Markdown
Member

Thanks!

is it in scope for @nuxt/image to transform blurhash into placeholder images?

Nop. It happens on server side of imgix

@pi0
https://docs.imgix.com/apis/rendering/format/fm#blurhash

It only freezes a key on the imgix side, you need to use it inside. so when we add this, the picture does not come back.

When uploading a picture, you need to first take it and show it. You can show the image when the image is finished uploading.

CleanShot 2021-09-06 at 07 11 10

@pi0

pi0 commented Sep 6, 2021

Copy link
Copy Markdown
Member

You are correct @productfrontenddeveloper. We still need placeholder support (#189) for loading strategy. Normally for providers not supporting blurhash, we use a pixel resized version of image but can also support native server blur ike this.

Meanwhile this format can be useful for cases a static blurry version is desired like a banner background image.

@Rigo-m

Rigo-m commented Oct 13, 2021

Copy link
Copy Markdown

What I did in userland is this:

  1. Fetched with $http the imgix blurhash hash
  2. Rendered the blurhash as a Base64 (using node-canvas if in SSR, using native canvas if in frontend)
  3. Placed Base64 as a background in a div
  4. Hid blurhash if image has already been loaded (image.complete attribute) or on @load event

It works well imho, should I try to implement it in nuxt-img? Any caveats/ideas on it?

procrates pushed a commit to procrates/nuxt-image that referenced this pull request Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: imgix Blurhash support

4 participants