Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-m-img-cropper

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-m-img-cropper

mobile image crop

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-41.18%
Maintainers
1
Weekly downloads
 
Created
Source

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

Demo

Live Demo avatar

Dependencies

  • Angular (requires Angular 4 or higher, tested with 4.4.6)
  • hammerjs (requires 2.0.8 or higher)

Installation

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

add hammerjs script in angular.json

"scripts": [
              "./node_modules/hammerjs/hammer.js", ...
            ]

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

Package last updated on 06 Sep 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc