In FCKEditor I had a custom image browser in a popup opened by the 'browser server' button.
When an image is selected this just called the following simple javascript:
window.top.opener.SetUrl( encodeURI( image.src ).replace( '#', '%23' ), null, null, image.alt ) ;
This would insert the selected image into the image dialog preview.
After upgrading to CKEditor, my image browser opens up fine still but SetUrl won't work, the function is undefined on window.top.opener. Although the documentation tells you how to specify your own image browser URL, I can't find a mention of how to actually handle image selection.
Thanks
When an image is selected this just called the following simple javascript:
window.top.opener.SetUrl( encodeURI( image.src ).replace( '#', '%23' ), null, null, image.alt ) ;
This would insert the selected image into the image dialog preview.
After upgrading to CKEditor, my image browser opens up fine still but SetUrl won't work, the function is undefined on window.top.opener. Although the documentation tells you how to specify your own image browser URL, I can't find a mention of how to actually handle image selection.
Thanks

Re: How to insert selected image in custom image browser
function SelectFile( fileUrl ) { window.opener.document.getElementById("88_textInput").value = fileUrl; //window.opener.document.getElementById("ImagePreviewBox").innerHTML="<img src='" + fileUrl + "' id='PreviewImage' />" + window.opener.document.getElementById("ImagePreviewBox").innerHTML; window.close(); }This works, partially. I noticed that when adding the image this way, the preview box didn't get the image inserted correctly, so I added the commented line, but then I found that there are two images in the preview pane if you click ok, then right click and edit the image properties.
In the older 2.6 code, there was a file called fckeditor\editor\dialog\fck_image\fck_image.js that included the SetUrl() function, so I tried copying that into the opening window, but it didn't work because the input boxes are all named differently now.
I have a lot of reading to do to learn more about the architecture so that I'll /really/ know why it broke. Anyway, hope this helps.
Re: How to insert selected image in custom image browser
viewtopic.php?f=11&t=15634
Re: How to insert selected image in custom image browser
http://docs.fckeditor.net/CKEditor_3.x/ ... ploader%29
Re: How to insert selected image in custom image browser
Setting the src on 'previewImage' instead of inserting a new image tag will solve the problem of multiple images when you add another to the wysiwyg:
This worked for me.
window.opener.document.getElementById("previewImage").src = encodeURI( image.src );
My text input had a different id to yours, "41_textInput", not sure where that's coming from. I'm not too happy having that id hard coded into the script for my image browser.
Re: How to insert selected image in custom image browser
window.opener.document.getElementById('txtUrl') doesn't work. I've tried CKEDITOR.dialog.getCurrent(), but that doesn't work. I'm still looking. Any ideas?
Re: How to insert selected image in custom image browser
Re: How to insert selected image in custom image browser
function setLink(url) { window.opener.CKEDITOR.tools.callFunction(1, url); window.close(); }Re: How to insert selected image in custom image browser
Thank you so much, this works perfectly.
Re: How to insert selected image in custom image browser
But wow, that is not intuitive at all. This should be documented somewhere. Is there a way to get a list of functions available to call? We'll have to look at the source I suppose to see the function definitions. I just saw this post and implemented it and it works like dream.
Thanks again!
Re: How to insert selected image in custom image browser
<a href="image.jpg"><img src="thumb.jpg"></a>
the image browser knows both addresses! can i do it somehow?
Re: How to insert selected image in custom image browser
Note that the funcNum parameter should not be static, this number should be sent to the image-browser in the first step (see the manual on how to generate the proper number) and then returned to the function.
Re: How to insert selected image in custom image browser
window.opener.CKEDITOR.tools.callFunction(2, url);
IE8 and Chrome seem to work with 1
window.opener.CKEDITOR.tools.callFunction(1, url);
Any ideas? I've spent the last several hours trying to de-bug this...
Re: How to insert selected image in custom image browser
function setLink(url)http://cksource.com/forums/viewtopic.php?f=6&t=21048
CKEDITOR.replace('message', { // filebrowserBrowseUrl: 'ckfinder/ckfinder.html', // how to put your function or the link of it here?? // ... , toolbar: [ ... ], resize_enabled: false});Remark:
Attachments:
Re: How to insert selected image in custom image browser
Hi,
This works for me ;
BrowseImage.cshtml;
<script type="text/javascript">
$(document).ready(function () {
$(function () {
$('a').click(function () {
window.opener.CkEditorURLTransfer($(this).attr('href'));
//window.opener.CKEDITOR.tools.callFunction('CkEditorURLTransfer("' + $(this).attr('href') + '")');
window.close();
});
});
});
</script>
Index.cshtml;
function CkEditorURLTransfer(url) {
// window.opener.CKEDITOR.tools.callFunction(1, url);
// window.close();
window.parent.CKEDITOR.tools.callFunction(1, url, '');
$('#cke_111_textInput').val(url);
}
URL identify access..
Hi, ckeditor the users
current page:
function BrowseServerUrlAdd(url){
$("label:contains('URL')").next().find("input[class='cke_dialog_ui_input_text']").val(url);
}
window.open (file finder):
function NewWindowClose(url) //posted url
{
if(url.length > 5) { //url check control (optional)
window.opener.UrlEkle(url); //current page - function
window.close();
}
}
Good work...