mirror of
https://gitee.com/shuto/customCamera.git
synced 2026-05-02 00:07:24 +08:00
Ajout de l'option pour stocker la photo dans la gallery android.
This commit is contained in:
@@ -52,8 +52,9 @@ public class CameraLauncher extends CordovaPlugin {
|
||||
}
|
||||
|
||||
intent.putExtra("miniature", args.getBoolean(1));
|
||||
intent.putExtra("cameraBackgroundColor", args.getString(2));
|
||||
intent.putExtra("cameraBackgroundColorPressed", args.getString(3));
|
||||
intent.putExtra("saveInGallery", args.getBoolean(2));
|
||||
intent.putExtra("cameraBackgroundColor", args.getString(3));
|
||||
intent.putExtra("cameraBackgroundColorPressed", args.getString(4));
|
||||
|
||||
cordova.startActivityForResult((CordovaPlugin) this, intent, CameraLauncher.REQUEST_CODE);
|
||||
|
||||
|
||||
@@ -660,16 +660,18 @@ public class CameraActivity extends Activity {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
photoTaken.compress(CompressFormat.JPEG, 70, stream);
|
||||
|
||||
// Get path picture to storage.
|
||||
String pathPicture = Environment.getExternalStorageDirectory()
|
||||
.getPath() + "/" + Environment.DIRECTORY_DCIM + "/Camera/";
|
||||
pathPicture = pathPicture
|
||||
+ String.format("%d.jpeg", System.currentTimeMillis());
|
||||
if (this.getIntent().getBooleanExtra("saveInGallery", false)) {
|
||||
// Get path picture to storage.
|
||||
String pathPicture = Environment.getExternalStorageDirectory()
|
||||
.getPath() + "/" + Environment.DIRECTORY_DCIM + "/Camera/";
|
||||
pathPicture = pathPicture
|
||||
+ String.format("%d.jpeg", System.currentTimeMillis());
|
||||
|
||||
// Write data in file.
|
||||
FileOutputStream outStream = new FileOutputStream(pathPicture);
|
||||
outStream.write(stream.toByteArray());
|
||||
outStream.close();
|
||||
// Write data in file.
|
||||
FileOutputStream outStream = new FileOutputStream(pathPicture);
|
||||
outStream.write(stream.toByteArray());
|
||||
outStream.close();
|
||||
}
|
||||
|
||||
TransferBigData.setImgTaken(stream.toByteArray());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user