Skip to content

gcoda/gcf-trivial-thumbnail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trivial Cloud Storage Thumbnail

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}

Deployed as google function

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

Test is not real

Just making sure Promise.all(sizes.map(size => ({ ...size }) uploads

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published