Ancentury / quill-image-compress

A Quill rich text editor Module which compresses images uploaded to the editor

Home Page:https://benwinding.github.io/quill-image-compress/src/demo.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

quill-image-compress

NPM Version License Downloads/week Github Issues

Quill.js Module which compresses images that are uploaded to the editor

Install

yarn add quill-image-compress

Quickstart

import ImageCompress from 'quill-image-compress';

Quill.register('modules/imageCompress', ImageCompress);

const quill = new Quill(editor, {
  // ...
  modules: {
    // ...
    imageCompress: {
      quality: 0.7, // default
      maxWidth: 1000, // default
      maxHeight: 1000, // default
      imageType: 'image/jpeg', // default
      debug: true, // default
    }
  }
});

Quickstart (script tag)

    <script src="/dist/quill.imageCompressor.min.js"></script>
    <script>
      Quill.register("modules/imageCompressor", imageCompressor);
      
      var quill = new Quill("#editor", {
        modules: {
          imageCompressor: {
            quality: 0.9,
            maxWidth: 1000, // default
            maxHeight: 1000, // default
            imageType: 'image/jpeg'
          }
        }
      });
    </script>

Options

  • maxWidth
    • Maximum width of images (in pixels)
  • quality
    • Image quality range: 0.0 - 1.0
  • imageType
    • Values: 'image/jpeg' , 'image/png' ... etc
  • debug
    • Displays console logs: true/false

Thanks

This project is based on quill-image-uploader, thanks mate!

About

A Quill rich text editor Module which compresses images uploaded to the editor

https://benwinding.github.io/quill-image-compress/src/demo.html


Languages

Language:JavaScript 74.5%Language:HTML 25.5%