I took the Camera Capture template from AppStudio for ArcGIS and uploaded it. I then went into Player on my phone and took a picture. I cannot see that image saved anywhere. I want to take this image and attach it to a feature with attributes but I first need the actual image to be captured....Am I doing something wrong?
Does this sample not capture and save to picture? Does it place it in limbo or somewhere that I can then save it somewhere? Sort of confused how this is working. Any ideas?
Solved! Go to Solution.
Everything was correct in my last example but needed to change it to this
ANY questions please ask....
WRONG
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.attachments.addAttachment(imagesFolder.filePath, "application/octet-stream", "captureTest.jpg");
}
CORRECT
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.attachments.addAttachment(camera.imageCapture.capturedImagePath, "application/octet-stream", "captureTest.jpg");
}
Jay,
The picture is stored at the path highlighted on the screen. See the image below.
Thank you,
Erwin
Thats what I thought....common sense right? ahahah
I cant find the image anywhere on my phone after taking the image....will check again....
Can you go to that location on your phone and see the image file there?
I cannot find the image anywhere on my phone after taking the picture....hmmmm
Erwin
Are you actually able to see the image on your mobile device?
Jay,
That path on iOS, /var/mobile/Containers/Data/Application/... is sand-box private application path. You can not just go to the location. But within the same application, you can refer to it using the path, and do things programmatically, such as display it and upload it as an attachment of a feature.
The same logic also applies in the QuickReport template where user can take pictures or videos, then upload them as attachments to a feature.
Thank you,
Erwin
OK....From the example onClicked in the camera window I see this:
MouseArea {
anchors.fill: parent;
onClicked: {
camera.imageCapture.captureToLocation(imagesFolder.filePath("captureTest.jpg"));
}
}
FileFolder {
id: imagesFolder
}
I am then trying to grab that image and attach it to a selected feature.....but something is not working as it does not upload the image to that feature....
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.attachments.addAttachment(imagesFolder.filePath, "application/octet-stream", "captureTest.jpg");
}
Does the syntax look correct? I can do this with the example that pops up the dialog box and I select the image from my phone and that works fine although the code is more like this
Having a hard time integrating the two ways to attach an image.
ANY IDEAS?
DocumentDialog {
id: fileDialog
function doAddAttachment(){
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.onLoadStatusChanged.disconnect(doAddAttachment);
selectedFeature.attachments.addAttachment(fileDialog.filePath, "application/octet-stream", fileInfo.fileName);
}
}
onAccepted: {
// add the attachment to the feature table
fileInfo.url = filePath
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.attachments.addAttachment(filePath, "application/octet-stream", fileInfo.fileName);
} else {
selectedFeature.onLoadStatusChanged.connect(doAddAttachment);
selectedFeature.load();
}
console.log(filePath)
}
}
//! [EditFeatures add attachment from a file dialog]
MessageDialog {
id: msgDialog
}
// file info used for obtaining the file name
FileInfo {
id: fileInfo
}
//Show storage permission pop-up on Android
FileFolder {
id: fileFolder
path: AppFramework.userHomePath
}
Component.onCompleted: {
fileFolder.makeFolder()
}
THINK I JUST GOT IT...ONE Second testing now... really excited.
Everything was correct in my last example but needed to change it to this
ANY questions please ask....
WRONG
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.attachments.addAttachment(imagesFolder.filePath, "application/octet-stream", "captureTest.jpg");
}
CORRECT
if (selectedFeature.loadStatus === Enums.LoadStatusLoaded) {
selectedFeature.attachments.addAttachment(camera.imageCapture.capturedImagePath, "application/octet-stream", "captureTest.jpg");
}