Giter Club home page Giter Club logo

Comments (7)

jakedohm avatar jakedohm commented on May 11, 2024

For anyone else interested in this issue, or who wants to know part of how g-image works, here's some of what I've found out so far:

  • When you pass a string into the src attribute on the g-image component, that src string gets processed and turned into an object containing a bunch of info about the image, including a small version of the image as a data URI.

How the image processing works:

  • When you pass a string into the g-image component, a custom Webpack loader (assets-loader) is called, which adds the image to a queue for processing.
  • The processing of the image is done by the preProcess method in the ImageProcessQueue (found in lib/app/queue/ImageProcessQueue.js)

I'll hopefully be digging into this more to figure out how I can get the Webpack loader to recognize the responsive attribute, and pass it along to the preProcess method to let it know to process the image at 2x.

from gridsome.

IssueHuntBot avatar IssueHuntBot commented on May 11, 2024

@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt

from gridsome.

marcfilleul avatar marcfilleul commented on May 11, 2024

Concerning the retina support, the solution proposed in this issue #288 should do the trick.

from gridsome.

marcfilleul avatar marcfilleul commented on May 11, 2024

I'm trying to improve by tweaking ImageProcessQueue.js but I spent too much time understanding all the code.

I can't find where I could remove the upper limit for generated sizes without removing it for the intrinsic size too.

@tomtev, could you help me with that ?

I have already modified:

options.sizes || [480, 640, 768, 1024, 1366, 1600, 1920, 2560] (but 2560 is never generated even if the width parameter is >= 2560

options.sizes || (max-width: ${imageWidth}px) 100vw, 50vw; (because 50vw seems better than fixed width for larger viewports)

from gridsome.

robaxelsen avatar robaxelsen commented on May 11, 2024

@tomtev @hjvedvik, see above comment ☝️

from gridsome.

syed-haroon avatar syed-haroon commented on May 11, 2024

for now falling back to native:
<img src='@/assets/images/img-01.png', srcset='@/assets/images/[email protected] 2x' />

Note: While using <img /> tag, use @ don't use ~ else you will get error.

from gridsome.

addonion avatar addonion commented on May 11, 2024

Hello in 2021 all sites need retina.
Can you add this request in Gridsome roadmap?

from gridsome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.