demoshop

demo, trying to be the best_

將CKFinder整合至FCKeditor

  • 2008-04-29
  • 23933
  • 0
官方網站
http://www.ckfinder.com/

有使用過FCKeditor的朋友一定對於他的強大功能讚嘆不已,但在圖片或檔案上傳到伺服器後FCKeditor給的遊覽介面真的很鳥,只有檔名,時間久了很容易忘記那到底是什麼檔案,其實這不是FCKeditor忘了作的地方,只是他們把它作成付費版本...雖然不是免費的,但是他的授權中是允許試用的所以我們就來用吧ˋˊ


★注意事項:CKFinder必須配合FCKeditor使用

▲我們將抓下來的CKFinder資料夾整各給它丟到fckeditor下的editor資料夾內



▲然後把ckfinder下的Bin內的CKFinder.dll拉到最外層的Bin去(ckfinder的bin可以刪了)



▲開啟ckfinder的config.ascx把一原本的return false;改成下方的return (Session["IsAuthorized"] != null && (bool)Session["IsAuthorized"] == true);

  public override bool CheckAuthentication()
 {
     // WARNING : DO NOT simply return "true". By doing so, you are allowing
     // "anyone" to upload and list the files in your server. You must implement
     // some kind of session validation here. Even something very simple as...
     //
     //        return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
     //
     // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
     // user logs on your system.
 
     return (Session["IsAuthorized"] != null && (bool)Session["IsAuthorized"] == true);
 } 

▲然後往下拉找到

BaseUrl = "/ckfinder/userfiles/";

把它修改成你真的要上傳的目錄


★注意事項:(如果你的FCKeditor已經有上傳檔案那就請設定的一樣吧,但CKFinder會預設利用資料夾來分門別類,所以可能您必須自動把圖像丟到images資料夾去


▲開啟的FCKeditor設定檔我們要把CKFinder連進去

X:\Web專案\WebSite1\fckeditor\fckconfig.js

▲刪除fckconfig.js原有的FCKConfig.LinkBrowserURL、FCKConfig.ImageBrowserURL、 FCKConfig.FlashBrowserURL、FCKConfig.LinkUploadURL、 FCKConfig.ImageUploadURL、FCKConfig.FlashUploadURL


▲將下方code貼到最後面去(當然你可以自行修改路徑)

FCKConfig.LinkBrowserURL = FCKConfig.BasePath+'ckfinder/ckfinder.html' ;
FCKConfig.ImageBrowserURL = FCKConfig.BasePath+'ckfinder/ckfinder.html?type=Images' ;
FCKConfig.FlashBrowserURL = FCKConfig.BasePath+'ckfinder/ckfinder.html?type=Flash' ;
FCKConfig.LinkUploadURL = FCKConfig.BasePath+'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files' ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath+'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images' ;
FCKConfig.FlashUploadURL = FCKConfig.BasePath+'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash' ; 


▲然後勒當我們在使用FCKeditor的時候挑一個可以上傳或遊覽伺服器的圖示後選擇瀏覽伺服器端



▲就可以看到美美的CKFinder啦

★注意事項:最上面那一條就很明白的顯示我們沒有給它錢@@該軟體的授權在此費用在此


▲如果只是美那它好意思收錢就過份了,我們在圖上按滑鼠右鍵就可以有如下的功能使用,讓我們管理伺服器上得檔案更方便啦。

回應討論