keystonejs-contrib / k6-contrib

Keyston-6 contrib
MIT License
35 stars 18 forks source link

S3 images - pre optimised images upload to S3 #7

Closed gautamsi closed 3 years ago

gautamsi commented 3 years ago

Create field for uploading per optimised images to S3.

This creates 4 copy of image uploaded

sm: this is copy of file with width 360px md: this is copy of file with width 720px lg: this is copy of file with width 1280px full: this is actual file uploaded

except the full, other sizes are customisable

configuration is similar to s3Image field with addition to sizes option.

you can pull individual image using graphql with fragment

main width and height is for full image, sizesMeta field gives all the sizes in JSON field.

{
  posts {
    image {
      id
      filesize
      width
      height
      extension
      ref(size: full)
      src(size: lg)
      sizesMeta
    }
  }
}