ngx-image-uploader-next
v1.1.6
Published
Angular asynchronous image uploader with preview. Fork of ngx-image-uploader-next.
Downloads
194
Maintainers
Readme
Angular image-uploader-next
This is a fork of ngx-image-updoader. Now supports Angular 16.
Angular image upload component with a preview and cropping features.
Demo
See demo here: demo
Install
npm install ngx-image-uploader-next --save
Usage
Add image uploader module to your module's imports
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app';
import { ImageUploaderModule } from 'ngx-image-uploader-next';
@NgModule({
imports: [BrowserModule, ImageUploaderModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
Use it in your component
import { Component } from '@angular/core';
import { ImageUploaderOptions, FileQueueObject } from 'ngx-image-uploader';
@Component({
selector: 'example-app',
template: '<ngx-image-uploader [options]="options" (upload)="onUpload($event)"></ngx-image-uploader>'
})
export class AppComponent {
options: ImageUploaderOptions = {
thumbnailHeight: 150,
thumbnailWidth: 150,
uploadUrl: 'http://some-server.com/upload',
allowedImageTypes: ['image/png', 'image/jpeg'],
maxImageSize: 3
};
onUpload(file: FileQueueObject) {
console.log(file.response);
}
}
License
MIT © 2020 Alexey Vladimirov