Load image from code behind and export image to custom location

10 posts, 1 answers
  1. Archana
    Archana avatar
    7 posts
    Member since:
    Nov 2015

    Posted 01 Jun 2018 Link to this post

    Hi,

    How do I set the path of ImageUrl in ImageEditor from code behind? radImageEditor.ImageUrl="<file path>" did not load the image.

    Also, how do I export the image to a custom file path?

  2. Answer
    Vessy
    Admin
    Vessy avatar
    2189 posts

    Posted 01 Jun 2018 Link to this post

    Hi Archana,

    RadImageEditor can work only with virtual paths to images placed inside the application root directory, so setting its ImageUrl from the code-behind should look like follows:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadImageEditor1.ImageUrl = "~/Images/image1.jpg";
    }

    As for the saving the image to a custom location, you can do it in the control's ImageSaving event like demonstrated in this live demo:
    https://demos.telerik.com/aspnet-ajax/imageeditor/examples/customsaving/defaultcs.aspx
    protected void RadImgEdt_ImageSaving(object sender, Telerik.Web.UI.ImageEditorSavingEventArgs args)
     {
         //Save the image to a custom location
         string fullPath = Server.MapPath("../../images/testImages");
         string fileName = string.Format("relax-{0}.jpg", DateTime.Now.ToString("yyyyMMdd-hhmmss"));
         fullPath = Path.Combine(fullPath, fileName);
     
         Telerik.Web.UI.ImageEditor.EditableImage img = args.Image;
         img.Image.Save(fullPath);
         //lblError.Text = "File Saved";
         args.Argument = String.Format("The image is saved under the name: <strong>{0}</strong>.", fileName);
     
         args.Cancel = true;
     }


    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Archana
    Archana avatar
    7 posts
    Member since:
    Nov 2015

    Posted 04 Jun 2018 in reply to Vessy Link to this post

    Thanks Vessy.. that helped.
  4. Vessy
    Admin
    Vessy avatar
    2189 posts

    Posted 04 Jun 2018 Link to this post

    Hi,

    You are welcome, Archana. Let us know should you meed any further difficulties with our controls.

    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. E.P.
    E.P. avatar
    6 posts
    Member since:
    Jan 2020

    Posted 04 Feb in reply to Vessy Link to this post

    Hi,

     

    In the linked page (which I've pasted below), there's a link to "Isolate this demo as a stand-alone application".

    https://demos.telerik.com/aspnet-ajax/imageeditor/examples/customsaving/defaultcs.aspx

     

    How do I get the demo project?

  6. Vessy
    Admin
    Vessy avatar
    2189 posts

    Posted 05 Feb Link to this post

    Hi Eli,

    The whole demo application can be downloaded in the Download section of your Telerik account (the installation file name is  Telerik_UI_for_ASP.NET_AJAX_2020_1_114_Demos_Dev.msi):
    https://www.telerik.com/account/product-download?product=RCAJAX

    On a side note, the source code of each demo is available just below it, in the C#/VB tabs, next to the demo description: https://www.screencast.com/t/exAwq8dUYAqj

    Regards,
    Vessy
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
  7. E.P.
    E.P. avatar
    6 posts
    Member since:
    Jan 2020

    Posted 06 Feb in reply to Vessy Link to this post

    Thank you.

    I'm finding it incredibly difficult to find the documentation. I went to one link that points to another link, which points back to the first link multiple times before I clicked on something (I can't even remember what) and finally found it.

    Anyway, I previously copied dll's and config information from an example project sent to me just before the purchase which seems to work fine in my project (other than not being able to figure out how to find the licence key in my account), but the video series has led me to this page:

    https://docs.telerik.com/devtools/aspnet-ajax/getting-started/first-steps

    In point 2 "Add the Controls to Your Project", it says

    "Go to Telerik > UI for ASP.NET AJAX > Convert to Telerik Web Application"

    But I have no "Telerik" menu in my VS 2017.

    I've downloaded the control panel and installed "Telerik UI for ASP.NET AJAX"

    In Visual Studio, under VS marketplace, I've installed
    "Progress Telerik UI for ASP.NET AJAX Extension"
    but can not find
    "Telerik ASP.NET AJAX VSExtensions" as per their image

    Can I get some help with what I should do?

    I'm also not happy with the idea of clicking some random button to "convert my project" which has hundreds if not thousands of other pages that should not be touched, affected or converted in any way, and I don't like the idea of this. If there's a series of steps that I know exactly what to add myself so that I can see everything that is changed, I would prefer that.

    Thank you

  8. Vessy
    Admin
    Vessy avatar
    2189 posts

    Posted 11 Feb Link to this post

    Hi Eli,

    The "Progress Telerik UI for ASP.NET AJAX Extension" is the name of the latest version of the extensions, so it is the proper one. Telerik ASP.NET AJAX VSExtensions is their name back in 2018, we will make sure to update the image with the new name as soon as possible.

    If you prefer full manual control over your project, you can copy the Telerik assemblies to the ~/bin and add references to them through the Visual Studio interface. You can take the needed DLLs from the installation folder of the controls, the path to which is usually like follows:
    C:\Program Files (x86)\Progress\Telerik UI for ASP.NET AJAX R1 2020\Bin45

    In this case you should also update the web.config:
    https://docs.telerik.com/devtools/aspnet-ajax/general-information/web-config-settings-overview#mandatory-additions-to-the-webconfig

    The controls come packaged in several assemblies and to get started, you only need Telerik.Web.UI.dll, Telerik.Web.UI.Skins.dll and Telerik.Web.Design.dll.

    Regards,
    Vessy
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
  9. E.P.
    E.P. avatar
    6 posts
    Member since:
    Jan 2020

    Posted 13 Feb in reply to Vessy Link to this post

    Thank you, that was very helpful.
  10. Vessy
    Admin
    Vessy avatar
    2189 posts

    Posted 18 Feb Link to this post

    Hi,

    You are welcome, Eli - let us know in case any further question about our controls occurs.

    Regards,
    Vessy
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Back to Top