Created
April 25, 2019 15:56
-
-
Save odoe/33db014a099a186d2db21e3f0d200a4c to your computer and use it in GitHub Desktop.
This file contains 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 { resolve } from 'path'; | |
import { v } from '@dojo/framework/widget-core/d'; | |
import * as sharp from 'sharp'; | |
export default async function (path: string) { | |
path = resolve(__dirname, path); | |
// resize my images | |
const images = [ | |
await sharp(path).resize(200).toBuffer(), | |
await sharp(path).resize(300).toBuffer(), | |
await sharp(path).resize(400).toBuffer(), | |
await sharp(path).resize(500).toBuffer() | |
]; | |
return images.map((a) => | |
v('img', { src: `data:image/jpeg;base64, ${a.toString('base64')}`, alt: 'sally' }) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment