我想将图像上传到 Cloudinary,使用 cordova 相机插件直接从 Ionic 中的相机拍摄。我收到代码 1 的错误,并显示消息“上传预设必须位于未签名上传的白名单中”。如何解决这个错误。请帮忙。
我编辑的js代码是:
$scope.cameraopen = function(){
var options = {
quality : 100,
destinationType : Camera.DestinationType.FILE_URI,//FILE_URI
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : false,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
targetWidth: 500,
targetHeight: 500,
saveToPhotoAlbum: true
};
$cordovaCamera.getPicture(options).then(function(imageData) {
var Uploadoptions = {
upload_preset: cloudinary.config().upload_preset,
tags: 'mytag',
context: 'photo=photo',
file: imageData
};
var onUploadSuccess = function(data){
console.log("success"+JSON.stringify(data));
}
var onUploadFail = function(e){
console.log("error"+JSON.stringify(e));
}
var ft = new FileTransfer();
ft.upload(imageData, "http://api.cloudinary.com/v1_1/" + cloudinary.config().cloud_name + "/upload", onUploadSuccess, onUploadFail, Uploadoptions, …Run Code Online (Sandbox Code Playgroud) 我正在显示在我的应用程序上注册的每月用户。为此,我使用了以下查询,效果很好。但是通过此查询,如果6月没有用户注册,则6月没有数据。我希望将6月和其他所有信息都设置为0。有人可以帮我吗?
SELECT Month(createdon), count(*) as users,COUNT(if(roleid=1,1,NULL)) as instructor, COUNT(if(roleid=2,1,NULL)) as student FROM user_profile where Year(createdon) = Year(Now()) group by MONTH(createdon);
我得到的输出为:
Month(created on) | users | instructor | student |
3 | 4 | 3 | 1 |
4 | 7 | 5 | 2 |
在这里,第3个月和第4个月分别对应于3月和4月。
但是实际输出是:
Month(created on) | users | instructor | student |
1 | 0 | 0 | 0 |
2 | 0 | 0 | 0 |
3 | 4 | 3 | 1 …