Giter Site home page Giter Site logo

monoimage's People

Contributors

jondashkyle avatar jongacnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

monoimage's Issues

single element

actually realized there's a slight issue with hacking the img element as a placeholder. If the element is set to expand to it's parent a grey border is applied to the element. Might be a way to solve this, opening issue here for time being. Might need to revert to wrapping element in a div

noscript support?

Would be nice to add a noscript element with the image. This would also benefit scrapers that don't run JS...

loaded callback

was discussing with @jondashkyle that for convenience might be good to be able to pass an image loaded callback. Could look something like:

var element = myImage.render(imagedata, {}, el => {
  console.log(`${el} has loaded`)
})

cant rerender on an unmounted dom node

Just dropping this here for reference, will be looking into. There's a case where rerender is triggered before dom node is mounted (classic nanocomponent bug).

Load higher resolution image than parent div

Hi!

Is there a way to make monoimage always load higher resolution image than its parent div's width? Perhaps it's doing that and I am missing something but the following occurs.

Case scenario:
I have two images: 1200px and 1800px wide. Around 1200px viewport width I re-render the view and it loads the 1800px image. But this works only on a retina device. On a non-retina it loads the 1200px image again which results in a blurry image on higher viewport widths. I want images to be extra sharp even if on the costs of loading time.

The above numbers are arbitrary at the moment but it's just to illustrate the symptoms.
Maybe this has an obvious solution but appreciate any help.

Perhaps I need to cover more resolutions and 1200-1800px is too much of a gap?

Is the following lines that I should adapt to my needs?

// limit ratio to 1.5x (full 2x is overkill)
this.deviceRatio = (typeof window !== 'undefined' && window.devicePixelRatio > 1) ? 1.5 : 1

Thank you!

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.