Coder Social home page Coder Social logo

js-crop's Introduction

Welcome to Js Crop ๐Ÿ‘‹

Documentation Maintenance License: MIT

Js Library to enable image cropping with built in UI(with color customization options to fit look and feel of you website/web app)

Install

npm i js-crop

Script

<script type:"text/javascript" src="src/js-crop.js"></script>
or 

<script type:"text/javascript" src="src/js-crop.min.js"></script>

Initialize

 new jsCrop('selector', (Image element or upload button selector/s refer to querySelector and querySelectorAll)
            { 
              extButton : (optional,extension which adds button after save image button)
                        { 
                          buttonText : string, (Optional, text for button)
                          buttonTitle : string, (Optional, title for button)
                          buttonCSS   : string, (Optional, additional styling for extension button)
                          callBack : function, (Required, callback function  which is passed blob of cropped image, on button click )
                        },
               customColor : (Optional,Js object conataining options for UI color customization)
                        {  
                            overlayBgColor : string, (Optional, background color for overlay)
                            toolbarBgColor : string, (Optional, background color for toolbar)
                            buttonBgColor :string,    (Optional, background color for buttons)
                            buttonFontColor : string, (Optional, font color for button)
                            
                      }, 
              imageType:string,(optinal,cropped image type,either jpeg or png)
              imageQuality: number,(opaitional, cropped image quality range 0 to 1);                
              saveButton:boolean (optional, set false to hide save button)
  },
  [ (Array of one or multiple button objects  like  one below โ˜Ÿ)
    { (Object with button properties)
      buttonText : string, (Optional, text for button)
      buttonTitle : string,(Optional, title for button)
      relParam : any,(Optional, any data type to be relayed back to callback function as second parameter)
      buttonEvent : event, (Optional, event to attach button for callback default click,  refer to "addEventListener" events)
      buttonCSS : string, (Optional, additinal styling for button)
      callBack : function,(required, callback function for button, which gets image blob as first parameter and relParam as second )
      },
  
  ]
  );

*parameter 1 (required) : selector for images to be cropped, one or multiple
*parameter 2 (optional): object to modify UI look and functionalities and develop library extension
*parameter 3 (optional): Array which contains objects for one or multiple buttons 

Contributing

Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.

Author

๐Ÿ‘ค ujw0l

Show your support

Show your support

Please โญ๏ธ this repository if this project helped you!

License

Copyright ยฉ 2019 ujw0l.

๐Ÿ“œ This project is MIT licensed.


This README was generated with โค๏ธ by readme-md-generator

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.