Custom File Browser"

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(New page: == Custom File Browser == To replace the default image file browser with, for instance a custom image gallery, edit the fckconfig.js and set (for example): FCKConfig.ImageBrowserURL = '/...)
 
Line 2: Line 2:
  
 
To replace the default image file browser with, for instance a custom image gallery, edit the fckconfig.js and set (for example):
 
To replace the default image file browser with, for instance a custom image gallery, edit the fckconfig.js and set (for example):
 
+
<pre>
FCKConfig.ImageBrowserURL = '/myfilebrowserpath/browser.php' ;
+
FCKConfig.ImageBrowserURL = '/myfilebrowserpath/browser.php'&nbsp;;
 
+
</pre>
 
=== Function SetUrl ===
 
=== Function SetUrl ===
  
Line 10: Line 10:
  
 
A very simple implementation (with no server side integration) could be something like this:
 
A very simple implementation (with no server side integration) could be something like this:
<pre>
+
<pre>&lt;html&gt;
<html>
+
&lt;head&gt;
<head>
+
&lt;title&gt;My File Browser&lt;/title&gt;
        <title>My File Browser</title>
+
&lt;script type="text/javascript"&gt;
        <script type="text/javascript">
 
  
 
function SelectFile( fileUrl )
 
function SelectFile( fileUrl )
 
{
 
{
        // window.opener.SetUrl( url, width, height, alt);
+
// window.opener.SetUrl( url, width, height, alt);
        window.opener.SetUrl( fileUrl ) ;
+
window.opener.SetUrl( fileUrl )&nbsp;;
        window.close() ;
+
window.close()&nbsp;;
 
}
 
}
        </script>
+
&lt;/script&gt;
</head>
+
&lt;/head&gt;
<body>
+
&lt;body&gt;
        <a href="javascript:SelectFile('File1.jpg');">File 1</a><br />
+
&lt;a href="javascript:SelectFile('File1.jpg');"&gt;File 1&lt;/a&gt;&lt;br /&gt;
        <a href="javascript:SelectFile('File2.jpg');">File 2</a>
+
&lt;a href="javascript:SelectFile('File2.jpg');"&gt;File 2&lt;/a&gt;
</body>
+
&lt;/body&gt;
</html>
+
&lt;/html&gt;
 
</pre>
 
</pre>
 +
 
== Related ===
 
== Related ===
  

Revision as of 17:03, 17 January 2008

Custom File Browser

To replace the default image file browser with, for instance a custom image gallery, edit the fckconfig.js and set (for example):

FCKConfig.ImageBrowserURL = '/myfilebrowserpath/browser.php' ;

Function SetUrl

When a file is selected on your custom File Browser implementation, you must simply call the "SetUrl" JavaScript function in the window.opener (the FCKeditor dialog that opened the File Browser), passing the URL of the file.

A very simple implementation (with no server side integration) could be something like this:

<html>
<head>
<title>My File Browser</title>
<script type="text/javascript">

function SelectFile( fileUrl )
{
// window.opener.SetUrl( url, width, height, alt);
window.opener.SetUrl( fileUrl ) ;
window.close() ;
}
</script>
</head>
<body>
<a href="javascript:SelectFile('File1.jpg');">File 1</a><br />
<a href="javascript:SelectFile('File2.jpg');">File 2</a>
</body>
</html>

Related =

If your custom browser handles uploading of images in a radically different way you might want to remember to disable the standard image uploading tab too:

FCKConfig.ImageUpload = false ;