Files
m3o-go/examples/image/upload/uploadAnImageFromAUrlToMicrosCdn/main.go
2021-11-03 15:36:34 +00:00

21 lines
433 B
Go
Executable File

package main
import (
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
func main() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}