I used this code to 'zoom out' the large image.It working only in ie8, firefox.
Image width and height is getting '0' in other browsers.
please tell me how to get the editable image height and width in chrome browser.
Script:
function OnClientLoad(sender, args) {
var editor = $find("<%= rieControl.ClientID %>");
if (sender._imageKey) {
var Width = sender.getEditableImage().get_width();
var Height = sender.getEditableImage().get_height();
if (!isNaN(Number(Width)) && Number(Width) != 0 && !isNaN(Number(Height)) && Number(Height) != 0) {
if (Width > 1000 || Height > 600) {
var widthPercentage = (1000 * 100) / Width
; var heightPercentage = (600 * 100) / Height;
widthPercentage = Math.floor(widthPercentage);
heightPercentage = Math.floor(heightPercentage);
if (heightPercentage > widthPercentage) {
sender.zoomImage(widthPercentage);
}
else {
sender.zoomImage(heightPercentage);
}
}
}
}
}
aspx:
<telerik:RadImageEditor ID="rieControl" runat="server" OnClientLoad="OnClientLoad" >
</telerik:RadImageEditor>
Image width and height is getting '0' in other browsers.
please tell me how to get the editable image height and width in chrome browser.
Script:
function OnClientLoad(sender, args) {
var editor = $find("<%= rieControl.ClientID %>");
if (sender._imageKey) {
var Width = sender.getEditableImage().get_width();
var Height = sender.getEditableImage().get_height();
if (!isNaN(Number(Width)) && Number(Width) != 0 && !isNaN(Number(Height)) && Number(Height) != 0) {
if (Width > 1000 || Height > 600) {
var widthPercentage = (1000 * 100) / Width
; var heightPercentage = (600 * 100) / Height;
widthPercentage = Math.floor(widthPercentage);
heightPercentage = Math.floor(heightPercentage);
if (heightPercentage > widthPercentage) {
sender.zoomImage(widthPercentage);
}
else {
sender.zoomImage(heightPercentage);
}
}
}
}
}
aspx:
<telerik:RadImageEditor ID="rieControl" runat="server" OnClientLoad="OnClientLoad" >
</telerik:RadImageEditor>