Coder Social home page Coder Social logo

ooade / pimg Goto Github PK

View Code? Open in Web Editor NEW
99.0 3.0 12.0 2.79 MB

:camera: Mini Image Lazy Loader for P(R)eact and Vue

Home Page: https://pimg.surge.sh

License: MIT License

JavaScript 82.58% Vue 17.42%
image-processing cloudinary image preact react lazy-loading lazy

pimg's Introduction

Pimg is a Progessive Image Component For React, Preact and Vue.js.

It helps in lazy loading of images in a nice and cool way.

It's 2KB (gzipped).

It has first-class support for Cloudinary Images.

build status npm version npm downloads

Installation

To install:

npm install --save pimg

Documentation

https://ooade.gitbooks.io/pimg/

Contributions

Feel free to send a PR.

Contributors

Thanks goes to these wonderful people (emoji key):


Ademola Adegbuyi

๐Ÿ’ป ๐Ÿ“– โš ๏ธ ๐Ÿ’ก

Olushi Luqman O.

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

pimg's People

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

pimg's Issues

Add Waypoint

Our implementation on ScrollToView is not cool enough, we need something a little bit powerful. We'd need to add react-waypoint as a dev-dependency and ask user to install it if needed. I'm not sure how we can pull this off easily ๐Ÿ˜…

Should we deprecate the thumbnail component?

I was just thinking, since the Thumbnail component just take in one prop, would it be nice to do away with it and just have it over to Image. We currently have a subtitute:

<Image thumbnail="someThumbURL" />

WDYT?

Deal with service workers

By default, we'll take out serving the mini image if a service worker is found, and activated. But, there will be a prop to ignore this feature

I think the one with the service worker could be checked this way:

if (
   'serviceWoker' in navigator && 
    navigator.serviceWorker.controller && 
    navigator.serviceWorker.controller.state === "activated"
) {
    // do some stuff
}

Size is not 20 bytes

Hey there! Neat package. Just wanted to let you know that the package size seems very wrong. If it was actually 20 bytes, that would mean the code literally fits in 20 characters, as each character is one byte. This is obviously impossible.

My guess is that the bundling command errored and you actually measured the length of the error message! ๐Ÿ˜…

Here's what I get:

$ cat pimg.js | gzip | wc -c
2035

So, roughly 2KB.

Test Preact and Vue Components

Right now we only have tests for React ๐Ÿ˜“ Having issues with using jest also for Preact as I keep having config clashes. Need help with this. Gracias ๐Ÿ™

Pre v2: Fix vulnerabilities

npm audit fix --force

With force applied, you might get a breaking change. It's the main reason I made this an issue because I might not have the time currently to fix it.

goodbye thumbnail, welcome placeholder

How about we ditch thumbnail and introduce placeholder? So we can also have placeholderClassName for customizations instead of loadingClassName because the placeholder is just an image to represent the void while we internally fetch the real image
cc @VinSpee / @codeshifu

P.S: With #14 we can just set some sensible defaults ๐Ÿ˜Ž to avoid typing that every single time.

Goodbye scrollToReveal, Welcome fetchOnDemand

I don't think scrollToReveal look lucid enough. I mean, it technically mean scroll to where the image is, then reveal. It might look like the image is already been fetched in the background and just renders once we get to the image position. fetchOnDemand does seem to look like what it should be or not???

WDYT?

Introducing plugins

I'll be creating a new library to take care of placeholders properly so non-cloudinary users that don't have a way of explicitly generating thumbnails can decide to use it or not using our plugin. It'll be a better replacement to the placeholder thumbnails.

tried to set the project up on my windows 10

i ran npm install to set it up an got this error.

>[email protected] minify:cjs C:\Users\setemiojo\Desktop\projects\r\pimg
> uglifyjs $npm_package_main -cm -o $npm_package_main --source-map

ERROR: ENOENT: no such file or directory, open 'C:\Users\setemiojo\Desktop\projects\r\pimg\$npm_package_main'

using git-bash terminal, node v8.12.0 , npm v6.4.0

Expose a singleton to save configs

Yay! This would be great. It'd be a nice addition to v1.0.0. By exposing a config, we can do stuffs like toggleDataSaver mode easily or getting the general classNames for the progressive images without having to keep typing this information every single time ๐Ÿ˜…

Add polyfill for IntersectionObserver API

Intersection Observer API which powers the lazy loading feature might fail in IOS if the polyfill is not added. One thing we could also do to avoid adding a dependency is to use componentDidCatch to catch errors related to this.

I would really love contributions from those using IOS, as I have no IOS devices to help test these features.

Demo - Missing

I don't want to be this guy. But, for me as a user who is trying to understand what this package is about and how it works, I just need a demo.

I don't want to "lose" time just by installing it and trying it out.

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.