Rxjs 6 and angular update for https://github.com/bergben/ng2-pica\
All development credit goes to: bergben
Angular wrapper for pica to resize images.
$ npm install ng6-pica --save
https://www.npmjs.com/package/ng2-pica
$ npm install ng2-pica --save
// app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { Ng6PicaModule } from 'ng2-pica'; // <-- import the module
import { MyComponent } from './my.component';
@NgModule({
imports: [BrowserModule,
Ng6PicaModule // <-- include it in your app module
],
declarations: [MyComponent],
bootstrap: [MyComponent]
})
export class MyAppModule {}
import { Ng6PicaService } from 'ng6-pica';
@Injectable()
export class ImgMaxPXSizeService {
constructor(private ng2PicaService: Ng6PicaService) {
this.ng2PicaService.resize([someFile], newWidth, newHeight).subscribe((result)=>{
//all good, result is a file
console.info(result);
}, error =>{
//something went wrong
console.error(error);
});
}
}
All Document refers back to original Author: https://www.npmjs.com/package/ng2-pica