This is a migrated thread and some comments may be shown as answers.

How to change the folder ImageEditor saves to

1 Answer 75 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MSiccDev
Top achievements
Rank 2
MSiccDev asked on 24 Jun 2014, 02:24 PM
Is there a way to change the folder for which RadImageEditor saves to?

1 Answer, 1 is accepted

Sort by
0
Accepted
Lance | Manager Technical Support
Telerik team
answered on 24 Jun 2014, 02:36 PM
Hi Marco,

Yes, you can absolutely save the edited image to a different location. you don't actually set the folder, instead you cancel the saving operation of the ImageEditor and then save the image to your desired location.

To help demonstrate this, I have written a demo (attached) that saves to the LocalFolder instead. Download and run the app. Click the "edit photo" button and make some changes to the image. When you're done editing it goes back to MainPage.xaml which then displays the edited image directly from LocalFolder.

You'll find the relevant code on DetailsPage.xaml.cs, here are the highlights from that page...

private void RadImageEditor_ImageSaving(object sender, Telerik.Windows.Controls.ImageSavingEventArgs e)
{
     //cancel the ImageSaving event
     e.Cancel = true;
 
     SaveToLocalfolderLocation("EditedImage.jpg");
}
 
private async void SaveToLocalfolderLocation(string fileName)
{
      //grab the modified image
      var img = myImageEditor.ModifiedImage as WriteableBitmap;
      img.Invalidate();
 
      //grab the folder you want
      var folder = Windows.Storage.ApplicationData.Current.LocalFolder;
 
      //set file properties
      var file = await folder.CreateFileAsync(fileName, Windows.Storage.CreationCollisionOption.ReplaceExisting);
 
      //save image
      using (Stream stream = await file.OpenStreamForWriteAsync())
      {
           img.SaveJpeg(stream, img.PixelWidth, img.PixelHeight, 0, 100);
      }
}


Thank you for contacting Support and thank you for choosing Telerik.

Regards,
Lance
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ImageEditor
Asked by
MSiccDev
Top achievements
Rank 2
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or