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

Fixed Canvas size in the controll and hardcode save image path

3 Answers 149 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Adeel
Top achievements
Rank 1
Adeel asked on 11 Sep 2014, 01:54 PM
i have 3 questions:

How can i fix the canvas size in RadImageEditor?
How can i hardcode target path in client side to save edited image on that path?
Can i set image size , resolution , pixel depth while saving my edited image?

Early response will be appriciated.
thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 16 Sep 2014, 11:38 AM
Hi Adeel,

i am not quite sure whether I understand the exact requirements properly. If you want to disable the resizing of the ImageEditor, so the visible part of the canvas will remain the same, you can configure the control's EnableResize property in a similar way:
<telerik:RadImageEditor ID="RadImageEditor1" runat="server" Width="680" Height="450" EnableResize="false">
</telerik:RadImageEditor>

If this is not the case, though, can you please explain in more details the exact scenario you want to achieve?

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.

 
0
Adeel
Top achievements
Rank 1
answered on 16 Sep 2014, 12:01 PM
Thanks for your concern , but you have miss interpreted me. i want to fix the size of drawing CANVAS inside this radimageeditor tool.
Also other two questions are still in queue for an answer.
Thank u
0
Accepted
Vessy
Telerik team
answered on 19 Sep 2014, 07:18 AM
Hello Adeel,

The size of the canvas is created depending on the currently loaded image's dimensions. If you want to fix the size of the canvas, you will need to fix the size of the edited images. For example, if you are giving the user the opurtunity to upload their own image, this can be done in the ImageLoading event in a similar way:
protected void RadImageEditor1_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
{
    //Handle Uploaded images
    if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
    {
        using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
        {
            int width = Convert.ToInt32(RadImageEditor1.Width.Value);
            int height = Convert.ToInt32(RadImageEditor1.Height.Value);
            //you might also substract the height of the toolbars here
            image.Resize(width, height); //image.Resize(200, 100);
            args.Image = image.Clone();
            args.Cancel = true;
        }
    }
}

In order to save the image to a custom location (was the path to it defined on the server or on the client) in the way demonstrated in the following lie demo: Save Image to a Custom Location
 
The functionality requested in your last question, though, cannot be currently achieved with the ImageEditor control.

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