All Projects → TaylorPzreal → ngx-cropper

TaylorPzreal / ngx-cropper

Licence: MIT license
An Angular image plugin, includes upload, cropper, save to server.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to ngx-cropper

pikaso
Seamless and headless HTML5 Canvas library
Stars: ✭ 23 (+64.29%)
Mutual labels:  crop, cropper
Croppy
Image Cropping Library for Android
Stars: ✭ 906 (+6371.43%)
Mutual labels:  crop, cropper
ngx-img
No description or website provided.
Stars: ✭ 25 (+78.57%)
Mutual labels:  crop, angular6
Cropper
Android Library for cropping an image at ease.
Stars: ✭ 21 (+50%)
Mutual labels:  crop, cropper
Cropiwa
📐 Configurable Custom Crop widget for Android
Stars: ✭ 2,185 (+15507.14%)
Mutual labels:  crop, cropper
ngx-image-editor
Awesome image editor for Angular 6
Stars: ✭ 74 (+428.57%)
Mutual labels:  crop, angular6
Tocropviewcontroller
A view controller for iOS that allows users to crop portions of UIImage objects
Stars: ✭ 4,210 (+29971.43%)
Mutual labels:  crop, cropper
react-native-avatar-crop
Highly customisable <Crop /> component for React Native < 💅 >
Stars: ✭ 47 (+235.71%)
Mutual labels:  crop, cropper
Pdfcropmargins
pdfCropMargins -- a program to crop the margins of PDF files
Stars: ✭ 141 (+907.14%)
Mutual labels:  crop, cropper
Krop
Small widget for image cropping in Instagram-like style
Stars: ✭ 107 (+664.29%)
Mutual labels:  crop, cropper
Croppr.js
A vanilla JavaScript image cropper that's lightweight, awesome, and has absolutely zero dependencies.
Stars: ✭ 294 (+2000%)
Mutual labels:  crop, cropper
react-simple-crop
✂️ A React component library for cropping and previewing images
Stars: ✭ 19 (+35.71%)
Mutual labels:  crop, cropper
React Cropper
Cropperjs as React component
Stars: ✭ 1,600 (+11328.57%)
Mutual labels:  crop, cropper
Rskimagecropper
An image cropper / photo cropper for iOS like in the Contacts app with support for landscape orientation.
Stars: ✭ 2,371 (+16835.71%)
Mutual labels:  crop, cropper
react-drop-n-crop
An opinionated implementation of react-dropzone and react-cropper
Stars: ✭ 17 (+21.43%)
Mutual labels:  crop, cropper
pdf-thumbnail
npm package to create the preview of a pdf file
Stars: ✭ 23 (+64.29%)
Mutual labels:  crop
Ecommerce
Angular 6 Ecommerce Application POC
Stars: ✭ 46 (+228.57%)
Mutual labels:  angular6
AuthGuard
Example repo for guarding routes post
Stars: ✭ 42 (+200%)
Mutual labels:  angular6
FunFilter
Freely painted area, the software will automatically add filter on its.
Stars: ✭ 15 (+7.14%)
Mutual labels:  crop
nodejs-angular-starter
A starter template to work with on NodeJS (typescript), Angular (with SSR), and shared models.
Stars: ✭ 13 (-7.14%)
Mutual labels:  angular6

ngx-cropper

An Angular5 image plugin, includes upload, cropper, save to server.

PRs Welcome

Example

Example

Usage

1. Install

  npm i -S ngx-cropper

2. Config example.module.ts

import { NgxCropperModule } from 'ngx-cropper';
import 'ngx-cropper/dist/ngx-cropper.min.css';

@NgModule({
  imports: [
    NgxCropperModule
  ]
})

3. Config example.component.html

  <ngx-cropper [config]="ngxCropperConfig" (returnData)="onReturnData($event)"></ngx-cropper>

4. Config example.component.ts

import { NgxCropperOption } from 'ngx-cropper';

@component()
export class ExampleComponent {
  public ngxCropperConfig: NgxCropperOption;

  constructor() {
    this.ngxCropperConfig = {
      url: null, // image server url
      maxsize: 512000, // image max size, default 500k = 512000bit
      title: 'Apply your image size and position', // edit modal title, this is default
      uploadBtnName: 'Upload Image', // default Upload Image
      uploadBtnClass: null, // default bootstrap styles, btn btn-primary
      cancelBtnName: 'Cancel', // default Cancel
      cancelBtnClass: null, // default bootstrap styles, btn btn-default
      applyBtnName: 'Apply', // default Apply
      applyBtnClass: null, // default bootstrap styles, btn btn-primary
      errorMsgs: {  // These error msgs are to be displayed to the user (not the ones sent in returnData)
        4000: null, // default `Max size allowed is ${maxsize}kb, current size is ${currentSize}kb`
        4001: null  // default 'When sent to the server, something went wrong'
      },
      fdName: 'file', // default 'file', this is  Content-Disposition: form-data; name="file"; filename="fire.jpg"
      aspectRatio: 1 / 1, // default 1 / 1, for example: 16 / 9, 4 / 3 ...
      viewMode: 0 // default 0, value can be 0, 1, 2, 3
    };
  }

  // deal callback data
  public onReturnData(data: any) {
    // Do what you want to do
    console.warn(JSON.parse(data));


    //  Here has three type of messages now
    //  1. Max size
    // {
    //     code: 4000,
    //     data: currentSize,
    //     msg: `Max size allowed is ${this.viewConfig.maxsize / 1024}kb, current size is ${currentSize}kb`
    //  }

    //  2. Error
    //  {
    //       code: 4001,
    //       data: null,
    //       msg: 'ERROR: When sent to the server, something went wrong, please check the server url.'
    //  }

    //  3. Image type error
    // {
    //       code: 4002,
    //       data: null,
    //       msg: `The type you can upload is only image format`
    // }

    //  4. Success
    //  {
    //       code: 2000,
    //       data,
    //       msg: 'The image was sent to the server successfully'
    //  }
  }
}

Development

Welcome you join us and develop together, it's my honor you commit pull request.

git clone [email protected]:TaylorPzreal/ngx-cropper.git

npm run start # start developing

npm run build # start building prod packages
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].