I have two web sites set up on one web server. One contains the fckeditor the other just outputs the contents produced with the editor.
Is it possible to set up the editor to browse the image directory on the other web site? They are both on the same file system. I tried using a physical path to the directory but that does not seem to work.
Any ideas? Is this even possible?
Michael Grove
Is it possible to set up the editor to browse the image directory on the other web site? They are both on the same file system. I tried using a physical path to the directory but that does not seem to work.
Any ideas? Is this even possible?
Michael Grove

Re: Possible to browse images on different web site
function GetFoldersAndFiles( $resourceType, $currentFolder ) { global $Config ; // setting current folder $currentFolder = $Config['FTPfolder'] . $currentFolder ; // Arrays that will hold the folders and files names. $aFolders = array() ; $aFiles = array() ; // set up a ftp connection or die $conn_id = ftp_connect($Config['FTPserver']); // try to login if (@ftp_login($conn_id, $Config['FTPuser'], $Config['FTPpwd'])) { echo "Connected as " . $Config[FTPuser] . "@" . $Config[FTPserver]; } else { echo "Couldn't connect as $Config[FTPuser]"; } //loading contents of current directory and changing the current directory. $contents = ftp_nlist($conn_id, $currentFolder ); ftp_chdir($conn_id, $currentFolder); //looping through the folder contents and adding to file or folder array. foreach ($contents as $sFile) { if ($sFile != '.' && $sFile != '..' && $sFile != '_notes') { $iFileSize = ftp_size($conn_id, $sFile); if ( $iFileSize > 0 ) { // size is greater than 0 so it is a file. $iFileSize = round( $iFileSize / 1024 ) ; if ( $iFileSize < 1 ) $iFileSize = 1 ; $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" base="' . $Config['FTPurl'] .'" />' ; } else { // size is not greater than 0 so it is a folder. $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />'; } } } // Send the folders natcasesort( $aFolders ) ; echo '<Folders>' ; foreach ( $aFolders as $sFolder ) echo $sFolder ; echo '</Folders>' ; // Send the files natcasesort( $aFiles ) ; echo '<Files>' ; foreach ( $aFiles as $sFiles ) echo $sFiles ; echo '</Files>' ; }Re: Possible to browse images on different web site
Re: Possible to browse images on different web site
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2007 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the File Manager Connector for PHP. */ function GetFolders( $resourceType, $currentFolder ) { global $Config ; // setting current folder $currentFolder = $Config['FTPfolder'] . $currentFolder ; // Arrays that will hold the folders and files names. $aFolders = array() ; // set up a ftp connection or die $conn_id = ftp_connect($Config['FTPserver']); // try to login if (@ftp_login($conn_id, $Config['FTPuser'], $Config['FTPpwd'])) { echo "Connected as " . $Config[FTPuser] . "@" . $Config[FTPserver]; } else { echo "Couldn't connect as $Config[FTPuser]"; } //loading contents of current directory and changing the current directory. $contents = ftp_nlist($conn_id, $currentFolder); ftp_chdir($conn_id, $currentFolder); //looping through the folder contents and adding to folder array. foreach ($contents as $sFile) { if ($sFile != '.' && $sFile != '..' && $sFile != '_notes') { $iFileSize = ftp_size($conn_id, $sFile); if ( $iFileSize < 0 ) { $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />'; } } } // Open the "Folders" node. echo "<Folders>" ; natcasesort( $aFolders ) ; foreach ( $aFolders as $sFolder ) echo $sFolder ; // Close the "Folders" node. echo "</Folders>" ; } function GetFoldersAndFiles( $resourceType, $currentFolder ) { global $Config ; // setting current folder $currentFolder = $Config['FTPfolder'] . $currentFolder ; // Arrays that will hold the folders and files names. $aFolders = array() ; $aFiles = array() ; // set up a ftp connection or die $conn_id = ftp_connect($Config['FTPserver']); // try to login if (@ftp_login($conn_id, $Config['FTPuser'], $Config['FTPpwd'])) { echo "Connected as " . $Config[FTPuser] . "@" . $Config[FTPserver]; } else { echo "Couldn't connect as $Config[FTPuser]"; } //loading contents of current directory and changing the current directory. $contents = ftp_nlist($conn_id, $currentFolder ); ftp_chdir($conn_id, $currentFolder); //looping through the folder contents and adding to file or folder array. foreach ($contents as $sFile) { if ($sFile != '.' && $sFile != '..' && $sFile != '_notes') { $iFileSize = ftp_size($conn_id, $sFile); if ( $iFileSize > 0 ) { // size is greater than 0 so it is a file. $iFileSize = round( $iFileSize / 1024 ) ; if ( $iFileSize < 1 ) $iFileSize = 1 ; $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" base="' . $Config['FTPurl'] .'" />' ; } else { // size is not greater than 0 so it is a folder. $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />'; } } } // Send the folders natcasesort( $aFolders ) ; echo '<Folders>' ; foreach ( $aFolders as $sFolder ) echo $sFolder ; echo '</Folders>' ; // Send the files natcasesort( $aFiles ) ; echo '<Files>' ; foreach ( $aFiles as $sFiles ) echo $sFiles ; echo '</Files>' ; } function CreateFolder( $resourceType, $currentFolder ) { global $Config ; // setting current folder $currentFolder = $Config['FTPfolder'] . $currentFolder ; $sErrorNumber = '0' ; $sErrorMsg = '' ; if ( isset( $_GET['NewFolderName'] ) ) { $sNewFolderName = $_GET['NewFolderName'] ; if ( strpos( $sNewFolderName, '..' ) !== FALSE ) $sErrorNumber = '102' ; // Invalid folder name. else { // set up a ftp connection or die $conn_id = ftp_connect($Config['FTPserver']); // try to login if (@ftp_login($conn_id, $Config['FTPuser'], $Config['FTPpwd'])) { echo "Connected as $Config[FTPuser]@$$Config[FTP]\n"; } else { echo "Couldn't connect as $Config[FTPuser]\n"; } // try to create the directory $dir if (ftp_mkdir($conn_id, $currentFolder . $sNewFolderName)) { echo "successfully created $dir\n"; } else { $sErrorNumber = '102' ; // Invalid folder name. } } } else $sErrorNumber = '102' ; // Create the "Error" node. echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ; } function FileUpload( $resourceType, $currentFolder ) { $sErrorNumber = '0' ; $sFileName = '' ; if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) { global $Config ; // setting current folder $currentFolder = $Config['FTPfolder'] . $currentFolder ; $oFile = $_FILES['NewFile'] ; // Get the uploaded file name. $sFileName = $oFile['name'] ; // Replace dots in the name with underscores (only one dot can be there... security issue). if ( $Config['ForceSingleExtension'] ) $sFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sFileName ) ; $sOriginalFileName = $sFileName ; // Get the extension. $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; $arAllowed = $Config['AllowedExtensions'][$resourceType] ; $arDenied = $Config['DeniedExtensions'][$resourceType] ; if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) ) { $iCounter = 0 ; // STEP 1: first we need to upload the file to local server so it can be resized. while ( true ) { if ($resourceType == 'Image') { $sFilePath = $Config['FTPworkingimage'] . $_POST['ddlImageSize'] . '-' . $sFileName ; } else { $sFilePath = $Config['FTPworkingimage'] . $sFileName ; } if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; if ( is_file( $sFilePath ) ) { $oldumask = umask(0) ; chmod( $sFilePath, 0777 ) ; umask( $oldumask ) ; } break ; } } // STEP 2: resizing the uploaded image using the class simple-image found in the scripts directory. If the uploaded image's width is // greater than the height, then we resize to the width of the user selected size. Vice versa for the height. if ($resourceType == 'Image') { include('../../../../../../../scripts/simple-image.php'); $image = new SimpleImage(); $image->load($sFilePath); if ($image->getWidth() > $image->getHeight()) { $image->resizeToWidth($_POST['ddlImageSize']); } else { $image->resizeToHeight($_POST['ddlImageSize']); } $image->save($sFilePath); } // STEP 3: moving the resized image to the ftp server. // set up a ftp connection or die $conn_id = ftp_connect($Config['FTPserver']); // try to login if (@ftp_login($conn_id, $Config['FTPuser'], $Config['FTPpwd'])) { // changing ftp directory ftp_chdir($conn_id, $currentFolder); $iCounter = 0 ; while ( true ) { if ($resourceType == 'Image') { $sFileName = $_POST['ddlImageSize'] . '-' . $sFileName ; } if ( ftp_size($conn_id, $sFileName) != -1 ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { ftp_put($conn_id, $sFileName, $sFilePath, FTP_BINARY); break ; } } } else { $sErrorNumber = '250' ; } //STEP 4: removing the file from the localserver unlink($sFilePath); } else { $sErrorNumber = '202' ; } } else $sErrorNumber = '202' ; echo '<script type="text/javascript">' ; echo 'window.parent.frames["frmUpload"].OnUploadCompleted(' . $sErrorNumber . ',"' . str_replace( '"', '\\"', $sFileName ) . '") ;' ; echo '</script>' ; exit ; } ?>Re: Possible to browse images on different web site
Re: Possible to browse images on different web site
Re: Possible to browse images on different web site
Re: Possible to browse images on different web site
For example if I wanted to set the image directory
Config.FileTypesPath["Image"] in "/fckeditor/editor/filemanager/connectors/cfm/config.cfm"
or one of the other variables in this file
or a variable in some other file?
Re: Possible to browse images on different web site
http://site1.comhttp://site1.com
Re: Possible to browse images on different web site
-Dak
Re: Possible to browse images on different web site
Re: Possible to browse images on different web site
is this possbiel for ASP.NET 2.0? FTP? how?