nuxt / nuxt/image

generate fallback images

Open
#147 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

I'm trying https://image.nuxtjs.org/nuxt-picture but my results aren't matching the documentation.

The documentation says:

When you use modern formats like webp in the component, a fallback image with jpeg format will be generated and used as a fallback image for old browsers.

Therefore, I to use it as the docs suggested:

            <nuxt-picture
              :src="imgUrl(webpimage)"
              sizes="300 (webp),300:600 (jpeg),600:900"
            />

(the function just places in a webp image)

An example of the resulting HTML is something like:

<picture>
<source srcset="/_image/ipx/remote/_/w_900_cover/http://localhost/hdwp-content/user/pages/01.home/wolves.webp" media="(min-width: 600px)">
<source srcset="/_image/ipx/remote/jpeg/w_600_cover/http://localhost/hdwp-content/user/pages/01.home/wolves.webp" type="jpeg" media="(min-width: 300px)">
<source srcset="/_image/ipx/remote/webp/w_300_cover/http://localhost/hdwp-content/user/pages/01.home/wolves.webp" type="webp" media="">
<img alt="wolves" class="__nim_o" style="position: absolute; left: 0px; top: 0px; margin: 0px; width: 100%; height: 100%; object-fit: cover; object-position: center center; transition: opacity 800ms ease 0ms; opacity: 1;" src="/_image/ipx/remote/jpeg/w_300_cover/http://localhost/hdwp-content/user/pages/01.home/wolves.webp">
</picture>

I tested the output in Safari 13 (Catalina) and nothing showed -- meaning that the JPG fallback wasn't generated. I tried PNG as well with no luck.

Am I implementing it wrong? Is the output HTML wrong?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented nuxt-picture example from https://image.nuxtjs.org/nuxt-picture with the generated HTML shown in the issue, then compare behavior in Safari 13. Trace how the JPEG or PNG fallback is selected and generated; done means the component renders an image in browsers without the modern format support.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.