New handy API to upload temp images
Hi everyone, Happy Lunar New Year ๐ ! Hope you guys are doing well there ๐ Today, we are going to share a new change in Copicake!
Based on some usersโ feedbacks, it seems that most of the users donโt have a speicifc place to host their own images, so itโs kinda inconvenient to handle this by themselves. In this way, we made a new API called uploadTempImage
to solve this problem!
With this API, we would host your temporary image in our S3 server, and you can freely use this image URL to call /image/create
API for image interpolation. (P.S. to avoid abuse, this image will be removed automatically in 1 day, so please use it as early as possible!)
To provide a better UX, we even implemented this API into our library and if you upgrade your Copicake library, you can get the benefit directly!
Here comes code snippets to let you know how to use this API:
JS / Node.js
copicake.utils
.uploadTempImage(file, "png")
.then((result) => {
// result === https://s3.ap-northeast-1.amazonaws.com/copicake/temp/ak0zixy6rewsh6vaamzi.png
console.log(result);
})
.catch((error) => {
console.log(error);
});
Swift
copicake.utils.uploadTempImage(pngData!, Extension.png) { error, url in
if error != nil {
debugPrint(error)
}
else {
// url == https://s3.ap-northeast-1.amazonaws.com/copicake/temp/ak0zixy6rewsh6vaamzi.png
debugPrint(url)
}
}
Thatโs all from todayโs release note and if you have any feedback or questions, feel free to drop us a message through our online contact form
Happy copicaking everyone ๐