Skip to content

Instantly share code, notes, and snippets.

View vishalsrini's full-sized avatar
🏠
Working from home

Vishal Srinivasan vishalsrini

🏠
Working from home
View GitHub Profile
@vishalsrini
vishalsrini / component.ts
Last active October 12, 2017 12:10
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.
import { Component, ViewChild } from '@angular/core';
declare var $: any;
declare var window;
@Component({
selector: 'app-init',
templateUrl: './app.component.html'
})
export class AppInit {
@vishalsrini
vishalsrini / resize.js
Last active June 27, 2023 03:24
A simple JavaScript to resize an image and create a blob out of it
window.resize = (function () {
'use strict';
function Resize() {}
Resize.prototype = {
init: function(outputQuality) {
this.outputQuality = (outputQuality === 'undefined' ? 0.8 : outputQuality);
},