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

[Solved] ImageManagerDialog src return value problem

1 Answer 90 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Eric Fernando
Top achievements
Rank 1
Eric Fernando asked on 13 Nov 2009, 08:54 PM
When using the ImageManagerDialog (I also have a custom FileContentProvider) either from within Editor or standalone, the return value of src includes the http://server at the beginning, exactly like the href return value. I expected it to be the url from the FileBrowser which is also the save as the value or src within the outerHTML return value.

Is this the expected behaviour?

ex:

href = http://localhost/Handler.ashx?path=images/foo.jpg
outerHTML = <IMG style="WIDTH: 120px; HEIGHT: 90px" src="/Handler.ashx?path=images/foo.jpg">
src = http://localhost/Handler.ashx?path=images/foo.jpg

shouldn't src = /Handler.ashx?path=images/foo.jpg

Thanks.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 18 Nov 2009, 03:26 PM
Hi Eric,

Please, see the following function:

<script type="text/javascript">   
function ImageManagerFunction(sender, args)   
{   
    var selectedItem = args.get_value();   
       
    var txt = $get('<%= TextBox1.ClientID %>');   
    if ($telerik.isIE)   
    {   
        ... 
    }   
    else   
    {    
        var path = args.value.getAttribute("src",2);   
        txt.value = "<img src='" + path + "' />";   
    }   
}

demonstrated in the Using the Image and Document managers outside RadEditor KB article. This line args.value.getAttribute("src",2);  in it returns the src value with a relative path. You can use this solution in your project as well.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Eric Fernando
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or