| 1000 | })()) |
| 1001 | |
| 1002 | var imageToPortrait = function (img) { |
| 1003 | const canvas = document.createElement('canvas') |
| 1004 | canvas.width = 100 |
| 1005 | canvas.height = 100 |
| 1006 | const ctx = canvas.getContext('2d') |
| 1007 | const scaleX = 100 / img.width |
| 1008 | const scaleY = 100 / img.height |
| 1009 | ctx.scale(scaleX, scaleY) |
| 1010 | ctx.drawImage(img, 0, 0) |
| 1011 | return canvas.toDataURL('image/png') |
| 1012 | } |
| 1013 | |
| 1014 | function __guard__ (value, transform) { |
| 1015 | return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined |