Sign inSign up

levinteractive/imageup

By levinteractive

•Updated over 7 years ago

A high speed image manipulation and storage microservice for Google Cloud Platform written in Go

Image
1

4.5K

levinteractive/imageup repository overview

⁠ImageUp for Google Cloud Platform (Storage)

It's recommended this be run as a private microservice (most likely within a Kubernetes cluster) because it does not handle any type of authentication. That should be done by the application interfacing with this service.

⁠Usage

You can use docker or just create a binary and run it.

docker run -it --rm levinteractive/imageup \
  -e GOOGLE_APPLICATION_CREDENTIALS=/path/to/servicefile.json \
  -e BUCKET_ID="my-bucket" \
  -e SERVER_PORT="8080"

⁠Environmental Variables

  • BUCKET_ID default: null (required)
  • CACHE_MAX_AGE default: 86400
  • SERVER_PORT default: 31111
  • CORS default: "*"

⁠API

⁠Remove file(s) from storage

Send a DELETE to / with the following argument.

Arguments:

  • files - A comma-delimited list of files. "file1, file2, etc"

Example by cURL:

curl -X DELETE \
  http://localhost:31111/ \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'files=foobar-82f100f-4bfd-4671-a0c1-9fc662782.jpg,foobar-38ef100f-4bfd-4671-a0c1-9fc667f2d924.jpg'
⁠Add files to storage

Send a POST to / with the following arguments.

Arguments:

  • file - Binary file data)
  • sizes - Array of file configurations to return

The file will be converted to all of the dimensions specified in the sizes argument. If the array below was sent, two images would be saved and returned.

[
  {
    "name": "large",
    "width": 1000,
    "height": 1000,
    "fill": false
  },
  {
    "name": "thumb",
    "width": 500,
    "height": 500,
    "fill": true
  }
]

Example by cURL:

curl -X POST \
  http://localhost:31111/ \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F file=@_DSC1814.jpg \
  -F 'sizes=[{"name": "foobar", "width":100, "height": 100, "fill": false}]'

⁠Response

The response objects will always be in the same order they were sent.

[
  {
    "fileName": "generatedname.jpg",
    "name": "large",
    "url": "https://the-public-url",
    "width": 500,
    "height": 500,
    "fill": true
  },
  {
    "fileName": "generatedname.jpg",
    "name": "thumb",
    "url": "https://the-public-url",
    "width": 500,
    "height": 500,
    "fill": true
  }
]

⁠Errors

The code will be a relevant http code⁠.

{
    "code": 405,
    "message": "invalid"
}

Tag summary

Content type

Image

Digest

Size

447.8 MB

Last updated

over 7 years ago

docker pull levinteractive/imageup:1.2.0