|
|
|
|
@@ -4,6 +4,66 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](htt
|
|
|
|
|
|
|
|
|
|
Endpoints:
|
|
|
|
|
|
|
|
|
|
## Upload
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
package example
|
|
|
|
|
|
|
|
|
|
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 UploadAbase64imageToMicrosCdn() {
|
|
|
|
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
|
|
|
rsp, err := imageService.Upload(&image.UploadRequest{
|
|
|
|
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
|
|
|
|
|
Name: "cat.jpeg",
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
fmt.Println(rsp, err)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
## Upload
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
package example
|
|
|
|
|
|
|
|
|
|
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 UploadAnImageFromAurlToMicrosCdn() {
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
## Resize
|
|
|
|
|
|
|
|
|
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
|
|
|
@@ -138,63 +198,3 @@ Url: "somewebsite.com/cat.png",
|
|
|
|
|
fmt.Println(rsp, err)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
## Upload
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
package example
|
|
|
|
|
|
|
|
|
|
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 UploadAbase64imageToMicrosCdn() {
|
|
|
|
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
|
|
|
rsp, err := imageService.Upload(&image.UploadRequest{
|
|
|
|
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
|
|
|
|
|
Name: "cat.jpeg",
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
fmt.Println(rsp, err)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
## Upload
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
package example
|
|
|
|
|
|
|
|
|
|
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 UploadAnImageFromAurlToMicrosCdn() {
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|