Hi Fravius,
Thanks for contacting syncfusion support.
Query: "How do I retrieve newImage path so as to save it somewhere else?"
In Forms.iOS we can't give any direct path to save the image file due to security reasons rather we can specify any of the predefined folder path which is listed under "Environment.SpecialFolder", to save an image.
You can save the images to the application folder with the Stream obtained from ImageSaving event. The Stream is then converted to image and saved inside the app location.
Please find below code snippet to save the image to app folder:
Code snippet:
string ISave.Save(Stream stream)
{
byte[] byteArray = null;
//Create Directory inside App Folder
var appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
var directoryname = Path.Combine(appdata, "Saved Images");
if (!Directory.Exists(directoryname))
Directory.CreateDirectory(directoryname);
stream.Position = 0;
// Convert Stream to byte[]
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
byteArray = ms.ToArray();
}
string savedPath = System.IO.Path.Combine(directoryname, "edits.jpg");
System.IO.File.WriteAllBytes(savedPath, byteArray);
return savedPath;
}
We have prepared a sample to achieve this requirement. Please find the sample from the below location:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/ImageSavingSample387064064
In the sample, we have used the stream obtained from the ImageSaving event saved as image in the Documents directory of the App. We have also displayed the image saved location as a pop up.
Note: Some of the SpecialFolders are Personal,MyDocuments,MyPictures etc.
Please get back us, if you need any further assistance from our side.
Regards,
Mohana V