简体   繁体   English

Parse.com不保存大于400KB的图像

[英]Parse.com not saving images greater than 400KB

I am having trouble uploading image in imageview that i get from phone gallery to the parse.com database. 我在将从手机图库中获得的imageview中的图像上传到parse.com数据库时遇到问题。 Parse says the file limit is 10MB. 解析表示文件限制为10MB。 Can anyone tell me what i'm doing wrong? 谁能告诉我我在做什么错?

ParseFile imgFile = new ParseFile(fullName+"_"+emp+".jpeg", bite_image);
imgFile.saveInBackground();

ParseObject teamTable = new ParseObject("TeamsTable");
teamTable.put("Team", team);
teamTable.put("Name", fullName);
teamTable.put("images", imgFile);
teamTable.saveInBackground(new SaveCallback() {

@Override
public void done(ParseException e) {
   if (e == null) {
      startActivity(new Intent(RegisterForm.this, Login.class));
      Toast.makeText(getApplicationContext(), "Successful Registration!", Toast.LENGTH_LONG).show();
      finish();


     } else {
     }
     }
  });

You should first save a PFFile containing your image, then add this PFFile to your object. 您应该首先保存一个包含图像的PFFile,然后将该PFFile添加到您的对象中。

PFFile *file = [PFFile fileWithName:@"image.jpg" data:UIImageJPEGRepresentation(image,1.)];
[file saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
    if (succeeded) {
      // Add the file to your object and save your object

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM