How to upload images to an independent image server using Fckeditor

Source: Internet
Author: User

I thought about the following solutions:
1. Enable FTP on the image server. You can add an image address manually, but it is not convenient, especially when you look at the image in the visual editor.
2. Enable FTP on the image server and raise IIS to execute dosShell to access ftp, but it is not safe.
3. Activate IIS on the image server and access the WEB Background directly (there is still a problem that is inconvenient to view in the editor, but you can use js to control the upload and automatically append it to the HTML editing window)
4. Use the existing online editor upload program.
Third, the four methods are relatively reliable, but cross-domain problems still need to be solved. The third method also needs to write programs separately, with a large number of changes. The fourth method is the most ideal.
So how can we achieve this? The background editor I used previously is the background editor of dvbbs. This time I switched to FCKeditor, but I am not very familiar with it. After one day, I finally succeeded in the experiment. The method is as follows:
1. Install FCKeditor on the image server (img.jb51.net) and backend server (gl.cdbs.com.cn). (In fact, only fckeditor. asp is required on gl.cdbs.com.cn, because asp cannot include Internet files)
2. Set sBasePath = http://img1.cdbs.com.cn/fckeditor/to create an editor. You can directly call the image server editor.

Copy codeThe Code is as follows: <%
Dim sBasePath
SBasePath = "http://img.jb51.net/fckeditor"
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
OFCKeditor. BasePath = sBasePath
OFCKeditor. Config ("SkinPath") = sBasePath + "editor/skins/silver/" 'set skin
& Apos; oFCKeditor. Width = "80%"
OFCKeditor. Height = "400px"
OFCKeditor. Value = ""
OFCKeditor. Create "FCKeditor1"
%>

3. Modify the "img.jb51.net/FCKeidtor/fckconfig.js" file.Copy codeThe Code is as follows: var _ FileBrowserLanguage = 'asp '; // asp | aspx | cfm | lasso | perl | php | py
Var _ QuickUploadLanguage = 'asp '; // asp | aspx | cfm | lasso | perl | php | py

4. Modify the "img.jb51.net/fckeditor/editor/filemanager/connectors/asp/config.asp" configuration file,
ConfigIsEnabled = true' the configuration must be enabled first.
5. Solve cross-origin access. However, you can set "document. domain = 'cdbs .com.cn ';" to solve this problem. There are also corresponding methods for completely different domain names,
6. You also need to solve the security problem. This can be used to determine whether you have the permission to upload (to be completed) through cross-site cookies ).
Finally, the image is uploaded to the corresponding image server in the background editor. The image address is a relative address, which can be distinguished by storing the current image server group. for example, "News Publishing" and other modules can do this. However, for other modules, such as the image presentation module and the music album module, multiple media files exist under one title, you still need to write the program independently. so how can we implement it?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.