ngx-image-uploader-next

Angular asynchronous image uploader with preview. Fork of ngx-image-uploader-next.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ngx-image-uploader-next
001.1.62 months ago4 years agoMinified + gzip package size for ngx-image-uploader-next in KB

Readme

Angular image-uploader-next
npm version Dependencies
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
MIT © Olegas Gončarovas