Git Product home page Git Product logo

react-blur-image-loader's Introduction

react-blur-image-loader

Progressive Image Loading for React.

Setup

  1. Install
npm install react-blur-image-loader react react-dom -S
  1. Usage
import {render} from 'react-dom';
import BlurImageLoader from 'react-blur-image-loader';

render(<BlurImageLoader src={"picture.jpg"} 
                        preview={"tiny-picture.jpg"} 
                        fullCover={true}
                        maxBlurLevel={10}
                        transitionTime={400}/>, document.getElementById("root"));
  1. Props
PropName Type Default Value Description
src string Null This field is REQUIRED, it specifies the final image url
preview string "" Specifies a preview image url, a preview image should be a tiny optimized image, it will be present until final image loaded, if preview is not defined, a spin loader would be present until final image loaded.
fullCover bool false Specifies whether image should cover its parent area or contain inside.
maxBlurLevel number 10 Specifies the level of Gaussian blur, refer to stdDeviation.
transitionTime number 400 Specifies the transition time from blur to clear, default value is 400ms.
loader React.Element <DefaultLoader /> Specifies the preview loader

react-blur-image-loader's People

Contributors

markocen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

Forkers

jchonde suprunov

react-blur-image-loader's Issues

Does not like SSR

ReferenceError: window is not defined
    at /home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:19644
    at /home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:19596
    at module.exports (/home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:20321)
    at Object.defineProperty.value (/home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:5852)
    at __webpack_require__ (/home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:603)
    at Object.content (/home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:6167)
    at __webpack_require__ (/home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:603)
    at /home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:1341
    at /home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:1386
    at installedModules (/home/stuart/ctink/node_modules/react-blur-image-loader/build/reactBlurImageLoader.js:1:90)

setState problem

setState evoke re-render of preview images, with every state change preview images are fetched from server.

BlurImageLoader sets container height to 150px

I am trying to integrate BlurImageLoader in the following way:

          <div className="tea-image-container">
            <BlurImageLoader
              src={teaType.image}
              preview={teaType.smallImage}
              fullCover={true}
              alt={teaType.header}/>
            <h1 className="title tea-image-title">&nbsp;&nbsp;{teaType.header}</h1>
          </div>

When I had the image as a standard image element, the height of the image was automatically set to the image width. So I had the image width set to 100%, and the image would resize to 1x1.

When I integrate the image in the above way, The container gets resized to 150px.

My container styles are set as following:

  position: relative;
  font-size: 0;
  width: 100%;

I am unable to pinpoint the issue, but you can reproduce it with the following repo(be careful to pull the branch issu#5):
https://github.com/Shooshte/teaTimer/tree/issue%235

The relevant code is in the TeaInfo.component.jsx.

Let me know if you need more information, nad thanks for looking into this.

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.