If you put a assets/pictures/photo1.jpg
thumbnailer will put assets/pictures/thumbnail/height_256/photo1.jpg
defined in src/resize.js
${dirname(Key)}/thumbnail/${prefix}/${basename(Key)}
Sizes and prefixes defined in src/sizes.js
.options
for sharp.resize()
.prefix
for uploading thumbnail/${prefix}
Change Google Cloud Project name in package.json
"scripts": {
"set-project": "gcloud config set project no-page",
}
You can change function name and triggering bucket --trigger-resource
"scripts": {
"deploy": "gcloud functions deploy thumbnailerAnigen --trigger-resource anigen ...",
}
Set env variables with
gcloud beta functions deploy thumbnailerAnigen \
--update-env-vars S3_KEY='KEYKEYKEY'
or just put a .env
file if you noob like me =)
S3_KEY=KEYKEYKEYKEYKEYKEYKEYKEY
S3_SECRET=SECRETSECRETSECRETSECRETSECRETSECRETSECRETSECRET
S3_ENDPOINT=https://storage.googleapis.com
S3_BUCKET=anigen
Just making sure Promise.all(sizes.map(size => ({ ...size })
uploads