Socket
Socket
Sign inDemoInstall

ngx-m-img-cropper

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-m-img-cropper

mobile image crop


Version published
Weekly downloads
77
increased by1825%
Maintainers
1
Install size
429 kB
Created
Weekly downloads
 

Readme

Source

ngx-m-img-cropper - Angular Mobile Image Crop

Demo

Live Demo avatar

Dependencies

  • Angular (requires Angular 8 or higher, tested with 8.0.3)
  • hammerjs (requires 2.0.8 or higher)

Installation

npm i hammerjs
npm i ngx-m-img-cropper

import hammerjs in main.ts

import 'hammerjs';

Once installed you need to import the main module:

import {ImgCropperModule} from 'ngx-m-img-cropper';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [ImgCropperModule, ...],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

the cropped image 's background color is green, you can change it by provide a MCropParams

 providers: [
    {provide: MCropParams, useValue: {backgroundColor: '#f0f0f0'}}, ...
  ]

add the m-img-cropper componet to your app.component.html

<m-img-cropper></m-img-cropper>

Usage

use it like this:

import { Component, OnInit } from '@angular/core';
import {ImgCropperService} from 'ngx-m-img-cropper';

@Component({
  selector: '...',
  templateUrl: '...',
  styleUrls: ['...']
})
export class Mine1Component implements OnInit {

  imgsrc = 'assets/header.jpg';
  constructor(private imgCropperService: ImgCropperService) { }

  ngOnInit() {
  }
  click(): void {
    this.imgCropperService.getCropImgData({width: 400, height: 300})
      .then(data => {
        this.imgsrc = data;
      });
  }

License

MIT License (MIT)

end

Keywords

FAQs

Last updated on 19 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc