GithubHelp home page GithubHelp logo

arturi / uppy-plugin-image-compressor Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 5.0 2.79 MB

Compresses images added to Uppy before upload, using compressorjs package

License: MIT License

JavaScript 100.00%

uppy-plugin-image-compressor's People

Contributors

arturi avatar

Stargazers

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

uppy-plugin-image-compressor's Issues

Compress to multiple sizes before uppy upload

Hi, thanks for the library! super easy to use

I was wondering if there was a way to compress to multiple file sizes, and then uploading all of those files. What I have so far is:

Uppy({
      id: "post",
      restrictions: {
        maxFileSize: 10000000,
        maxNumberOfFiles: 1,
        allowedFileTypes: ["image/png", "image/jpeg"],
      },
      meta: {
        postId: postId,
        size: "small",
        uploadPath: `website/post/${postId}/small`,
      },
    })
      .use(ImageCompressor, {
        id: "post_compressor",
        quality: 0.8,
        maxWidth: 1500,
        maxHeight: 1500,
        convertSize: 200000,
      })
      .use(AwsS3, {
        id: "post_aws",
        limit: 1,
        companionUrl: baseServerUrl,
        metaFields: ["postId", "size", "uploadPath"],
      })
      .on("upload-success", (file: any, data: any) => {console.log('success')})

I want to define 3 different compressors for 3 different image sizes. I've tried "chaining" the events like so:

 .use(ImageCompressor, {...}).use(AwsS3,{...})
 .use(ImageCompressor, {...}).use(AwsS3,{...})
 .use(ImageCompressor, {...}).use(AwsS3,{...})

But that doesn't work for me. Any help would be appreciated, thanks!

Gif animation removed

When compressing a gif, the compressor removes the gif animation. Is there a way around this?

Not running when used with Dashboard

Hi,

Thanks for the awesome plugin!
Are u sure it's running fine when used with Dashboard?
I managed to load it but doesn't do a thing.

Are there any special instructions to bootload it?

Options not working

Hello,

If I upload a gif, the image compressor will still compress it regardless of the convertSize or convertTypes option I pass in.

I have the following code:

this.uppy = Uppy({
restrictions: {
maxFileSize: 10000000,
maxNumberOfFiles: 1,
allowedFileTypes: [ 'image/png', 'image/jpeg', 'image/gif' ]
}
})
.use(ImageCompressor, {
maxWidth: 2048,
maxHeight: 2048,
convertTypes: ['image/png','image/jpeg'],
convertSize: 1000000
})

Why aren't the options working?

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.