Last active
October 12, 2017 12:10
-
-
Save vishalsrini/eb31b404cf59d261d6b4ee83c6c8a14b to your computer and use it in GitHub Desktop.
Typescipt to make use of resize.js. Make sure you added the resize.js in your assets folder and given the reference to your angular-cli in scripts array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, ViewChild } from '@angular/core'; | |
declare var $: any; | |
declare var window; | |
@Component({ | |
selector: 'app-init', | |
templateUrl: './app.component.html' | |
}) | |
export class AppInit { | |
private base64textString: String = ""; | |
handleFileSelect(evt) { | |
var files = evt.target.files; | |
var file = files[0]; | |
var resize = new window.resize(); | |
resize.init(); | |
resize.photo(files[0], 500, 'dataURL', (thumbnail) => { | |
file = thumbnail; | |
console.log(file); | |
this.base64textString = file; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment