/**
* 切割文件到临时文件
*/
public
void
startPhotoZoom(Uri uri) {
Utils.doLog(
"----->>>> startPhotoZoom2"
);
Intent intent =
new
Intent(
"com.android.camera.action.CROP"
);
intent.setDataAndType(uri, IMAGE_UNSPECIFIED);
intent.putExtra(
"crop"
,
"true"
);
intent.putExtra(
"outputX"
,
600
);
intent.putExtra(
"onFaceDetection"
,
true
);
intent.putExtra(
"return-data"
,
false
);
intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
intent.putExtra(
"outputFormat"
, Bitmap.CompressFormat.JPEG.toString());
startActivityForResult(intent, PHOTORESOULT);
}
protected
Uri getTempUri() {
return
Uri.fromFile(getTempFile());
}
protected
File getTempFile() {
if
(isSDCARDMounted()) {
File f =
new
File(Environment.getExternalStorageDirectory(),camera_crop_temp_file);
try
{
f.createNewFile();
}
catch
(IOException e) {
Toast.makeText(
this
,
"SD临时文件读取错误!"
, Toast.LENGTH_LONG).show();
}
return
f;
}
else
{
File f =
new
File(getCacheDir(), camera_crop_temp_file);
try
{
f.createNewFile();
}
catch
(IOException e) {
Toast.makeText(
this
,
"缓存目录临时文件读取错误!"
, Toast.LENGTH_LONG).show();
}
return
f;
}
}