Skip to content

A javascript library to handle the altering of bitmap data in the DOM.

License

Notifications You must be signed in to change notification settings

stwilz/crop-resize

Repository files navigation

#Resize & Crop A vanilla Javascript library that provides the tools and UI necessary to manipulate an image file in browser.

##Features

  • Fully stylable with CSS.
  • No JS dependencies.
  • It's responsive
  • Supports drag and drop

##Usage

var cropArea     = document.querySelector('[data-cropresize-target]'),
    cropResize   = CropResize(cropArea, {
         fileInput       : document.querySelector('input#file-uploader[type="file"]'),
         dropArea        : document.querySelector('[data-drag-drop-target]'),
         previewElement  : document.querySelector('[data-cr-preview]')
    });

##Browser Support

IE Edge Chrome Mozilla Safari

##API ###CropResize(fileInput, cropArea, settings):ICropResizeInterface

Name Type Description
cropArea element The element that will be used for file cropping. May be a canvas element or any open (<></>) tag element.
settings object And object of optional arguments that may be supplied to the initializer.

###ICropResizeInterface

Name Type Description
destroy function() Removes the class and unbinds all event listeners
getInfo function():IInformationInterface

###Settings

Name Type Description
fileInput element File input element required for uploading files into the ui.
dropArea element boolean
previewElement element If this element is an it's src will get updated, otherwise it will have it's background image set.

###IInformationInterface

##License See LICENSE.

About

A javascript library to handle the altering of bitmap data in the DOM.

Resources

License

Stars

Watchers

Forks

Packages

No packages published