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

RadImageEditor getEditableImage saves uncropped version of the image

2 Answers 123 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Aadil
Top achievements
Rank 1
Aadil asked on 10 Apr 2014, 11:46 PM
Hi Telerik team,

I am a newbie programmer and have been using Telerik since a couple of months now.

I am trying to implement the follwing process:

1. User uploads an Image on RadImageEditor using AsyncUpload
2. User crops the image
3. User clicks on CreateProfile button on the page.
4. The cropped image should be stored in the database.

Problem: The uncropped version of the image gets stored. I think I am doing something wrong. Would be great if you could help

Code:

.aspx

<telerik:RadImageEditor  ID="ImageEditor_CreateNewUser"   CanvasMode="No" runat="server" Height="500px" Width="700px"     OnImageLoading="ImageEditor_CreateDonor_ImageLoading" OnClientCommandExecuting="OnClientCommandExecuting">
</telerik:RadImageEditor>

<asp:Button ID="BtnDonorSave" Text="Create Donor" ValidationGroup="CreateDonorSubmit" runat="server" OnClick="BtnDonorSave_Click" />

  .aspx.cs - 

        protected void ImageEditor_CreateNewUser_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
        {
            if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
           {
                using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
                {
                    args.Image = image.Clone();
                    args.Cancel = true;
                }
           }
        }
 protected void BtnDonorSave_Click(object sender, EventArgs e)
        {
             EditableImage ei = ImageEditor_CreateDonor.GetEditableImage();
            MemoryStream s = new MemoryStream();
            ei.Image.Save(s, ei.RawFormat);
            byte[] imgData = s.ToArray();

            db.CreateUser(userId, imgData);

}
















2 Answers, 1 is accepted

Sort by
0
Aadil
Top achievements
Rank 1
answered on 10 Apr 2014, 11:52 PM
Please note it is "ImageEditor_CreateNewUser" instead of "ImageEditor_CreateDonor" . [quote]Aadil said:
             EditableImage ei = ImageEditor_CreateDonor.GetEditableImage();
          

}
















[/quote]
0
Vessy
Telerik team
answered on 15 Apr 2014, 02:30 PM
Hi Aadil,

We are aware of a similar to the the described issue and it has been logged into our bug-tracking portal. You can track its progress and vote for it here: A large uploaded image is not saved properly after cropping in disabled CanvasMode

I will contact our developers in order to increase the priority of the bug. Unfortunately, the only workaround I could suggest you for the moment is to use the ImageEditor in enabled CanvasMode, calling the control's saveImageOnServer() method in the ClientClick handler of the button.

Kind regards,
Vessy
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
Aadil
Top achievements
Rank 1
Answers by
Aadil
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or