Picture File Upload to Parse

im trying to create my Photo-app orientating on this example http://www.androidhive.info/2013/09/android-working-with-camera-api/

       public void onClick(View view) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // create Intent to take a picture and return control to the calling application
            fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
            intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
            startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); // start the image capture Intent
        }

I can take a camerapicture and display it in a preview. Now im trying to upload the image ive been taking to Parse, so ive tried to do it like this

File screen = new File(fileUri.getPath());

...

ParseObject placeObject = new ParseObject("Place");

placeObject.put("Image",screen);

Which unfortunately throws following exception:

java.lang.IllegalArgumentException: invalid type for value: class java.io.File

Someone told me i had to scale the taken picture like in the mealspottingexample, method "saveScaledPhoto" (https://github.com/ParsePlatform/MealSpotting/blob/master/src/com/parse/mealspotting/CameraFragment.java). So my question now is, do i actually have to scale my picture before i can upload it to Parse or am i making a majormistake creating the file initially?

链接地址: http://www.djcxy.com/p/68820.html

上一篇: 使用FileProvider时设置文件权限

下一篇: 图片文件上传到分析