将图像上传到 cloudinary 服务器时如何更改图像名称?
how can I change the name of my image when uploading it to the cloudinary server?
我正在尝试将 base64 格式的图像名称更改为稍后定义的名称。我该怎么做?我想自定义cloudinary server中的名字
var uploadOptions = {
params : {
//'upload_preset': "YOUR_IMAGE_UPLOAD_PRESET",
'upload_preset': "xxx",
}
//imageURI is base64 image
//.upload("YOUR_IMAGE_UPLOAD_LINK", imageURI, uploadOptions)
.upload("https://api.cloudinary.com/v1_1/xxxx/image/upload", imageURI, uploadOptions)
.then(function(result) {
使用 public_id
参数命名图像,例如:
var uploadOptions = {
params : {
//'upload_preset': "YOUR_IMAGE_UPLOAD_PRESET",
'upload_preset': "xxx",
'public_id': "imageName"
}
它也可以包含文件夹。例如:
'public_id': "myfolder/imagename"
或
'public_id': "imagename"
'folder': "myfolder"
您可以阅读更多相关信息 here。
我正在尝试将 base64 格式的图像名称更改为稍后定义的名称。我该怎么做?我想自定义cloudinary server中的名字
var uploadOptions = {
params : {
//'upload_preset': "YOUR_IMAGE_UPLOAD_PRESET",
'upload_preset': "xxx",
}
//imageURI is base64 image
//.upload("YOUR_IMAGE_UPLOAD_LINK", imageURI, uploadOptions)
.upload("https://api.cloudinary.com/v1_1/xxxx/image/upload", imageURI, uploadOptions)
.then(function(result) {
使用 public_id
参数命名图像,例如:
var uploadOptions = {
params : {
//'upload_preset': "YOUR_IMAGE_UPLOAD_PRESET",
'upload_preset': "xxx",
'public_id': "imageName"
}
它也可以包含文件夹。例如:
'public_id': "myfolder/imagename"
或
'public_id': "imagename"
'folder': "myfolder"
您可以阅读更多相关信息 here。