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

Save and Export tool not working

3 Answers 67 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Vikram
Top achievements
Rank 1
Vikram asked on 04 Nov 2015, 03:02 PM

Hi,
We are using the telerik version 2015.3.930.45.
We are facing issue with Save and Export.
RadImageEditor Code in HTML

  <telerik:RadImageEditor ID="testImageViewer" runat="server" ImageUrl="https://xxxxxx-xxxxxx.us/EDMTempfiles/10068_Image/nature2.jpg" EnableResize="true"  EnableViewState="true" ToolsFile="~/Config/RadImageEditor.xml" >

1. When we click on Save button on tool, select “Downlaod Image” from “Save Dialog” and click “Ok” button then only .png file is downloading but we set .jpg image in the ImageUrl property and expecting .jpg file in download. 

2. When we click on “Export” button in tool, we are getting the below error
Message : ="https://xxxxxx-xxxxxx.us/EDMTempfiles/10068_Image/nature2.jpg ' is not a valid virtual path.
Source : System.Web
Help link :
WebEventCode : 0
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void CheckValidVirtualPath(System.String)
HResult : -2147467259
Stack Trace :    at System.Web.Util.UrlPath.CheckValidVirtualPath(String path)
   at System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative)
   at System.Web.VirtualPath.Combine(VirtualPath relativePath)
   at System.Web.UI.Control.ResolvePhysicalOrVirtualPath(String path, VirtualPath& virtualPath, String& physicalPath)
   at System.Web.UI.Control.MapPathSecure(String virtualPath)
   at Telerik.Web.UI.RadImageEditor.TryGetEditableImageFromSource(Boolean alwaysCreateEditableImage)
   at Telerik.Web.UI.ImageEditor.Export.GetImageExtension()
   at Telerik.Web.UI.ImageEditor.Export.SetChildrensProperties()
   at System.Web.UI.Control.EnsureChildControls()
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.AddedControl(Control control, Int32 index)
   at Telerik.Web.UI.RadImageEditor.LoadDialog(String dialogName)
   at Telerik.Web.UI.RadImageEditor.LoadTool(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Please let me know if I am doing something wrong with imageEditor properties.

3 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 09 Nov 2015, 11:54 AM
Hello Vikram,

Using images from external URL (http://host/image) is not supported as an out-of-the-box feature. It may render, but server-side operation over the image cannot work for this scenario. 

In order to support such URLs, you should implement your own Image Content Provider that achieves your needs and fits the application's requirements. 

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Vikram
Top achievements
Rank 1
answered on 18 Nov 2015, 02:43 PM

Hello Lanko,

 Thanks for your reply.

I tried Image Content Provider but did not get any success. Please provide an example, How to Implement Image Content Provider.

Thanks

0
Ianko
Telerik team
answered on 19 Nov 2015, 10:58 AM
Hi Vikram,

I am sorry for misleading you on that. 

It appears that the source to the image is always processed via the Control.MapPathSecure method. And thus, no mater what result the LoadImage returns, the MapPathSecure method always throws an exception for such URLs. 

It seems to me that this is an entirely non-supported scenario. I can also suggest you to put this as a feature request in our public portal—http://feedback.telerik.com/Project/108/.

Alternative solution is to always download the file on the server and loading it properly before loading RadImageEditor:
protected override void OnInit(EventArgs e)
{
    string imageUrl = RadImageEditor1.ImageUrl;
 
    using (WebClient wc = new WebClient())
    {
        wc.DownloadFile(imageUrl, Server.MapPath("~/Images/image.jpg"));
    }
 
    RadImageEditor1.ImageUrl = "~/Images/image.jpg";
 
    base.OnInit(e);
}

Of course, this process should be further updated so that the file is saved with the proper extension.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ImageEditor
Asked by
Vikram
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Vikram
Top achievements
Rank 1
Share this question
or