Jul 15

PJ博客实现远程图片自动上传 晴

碟舞飞扬 , 17:18 , 技术文章 , 评论(0) , 引用(0) , 阅读(3488) , Via 本站原创 | |
    由于需要经常转载一些带图片的文章,可直接复制过来,远程地址容易失效,用UBB和FCK都不能实现远
程图片保存本地功能,像我这种习惯转载的人来说是不能忍受的。于是决定动手更换fck为ewebeditor.

1.下载ewebeditor,这里我用的是ewebeditor4.4完全版。用过什么4.6精简版和所谓的4.8版都出现远程文件自动上传乱码的问题。关于ewebeditor4.4完全版,到网上搜索很容易下载到或者下载下方的附件,解压后,把ewebeditor文件夹(注意是ewebeditor,不是改为此文件夹名)放到网站根目录下。
附件下载:ewebeditor4.4完全版

2.没有更改过blogpost.asp和blogedit.asp的可以直接下载附件直接覆盖即可,已经做过其它更改的,可以参照以下方法手动更改。

附件下载:已修改的文件

更改过的可以按照下面的方法修改:
a.更改发帖页面blogpost.asp,共计更改四处。
第一处: 编辑器选择
原文件:
<label title="UBB编辑器" for="ET1" accesskey="U"><input type="radio" id="ET1" name="log_editType" value="1" checked="checked" />UBBeditor</label>         <label title="FCK在线编辑器" for="ET2" accesskey="K">
          <input name="log_editType" type="radio" id="ET2" value="0" />        
          FCKeditor</label>
更改为:
<label title="UBB编辑器" for="ET1" accesskey="U">
                <input type="radio" id="ET1" name="log_editType" value="1" checked="checked" />
                UBBeditor</label>
                 <label title="FCK在线编辑器" for="ET2" accesskey="K">
                <input name="log_editType" type="radio" id="ET2" value="0" />
                FCKeditor</label>
                 <label title="ewebeditor编辑器" for="ET2" accesskey="E">
                <input name="log_editType" type="radio" id="ET2" value="2" />
                Ewebeditor</label>

第二处: 发表内容区

原文件:
if log_editType=0 then
         Dim sBasePath
         sBasePath = "fckeditor/"
         Dim oFCKeditor
         Set oFCKeditor = New FCKeditor
         oFCKeditor.BasePath = sBasePath
         oFCKeditor.Config("AutoDetectLanguage") = False
         oFCKeditor.Config("DefaultLanguage")    = "zh-cn"
         oFCKeditor.Value = ""
         oFCKeditor.Create "Message"
    else
    UBB_TextArea_Height="200px;"
    UBB_AutoHidden=False
  UBBeditor("Message")
   end if


更改为:

if log_editType=0 then %>
    <input type="hidden" name="message" id="message" value="" />
     <iframe ID="eWebEditor1" src="ewebeditor/ewebeditor.htm?id=message&style=gray" frameborder="0" scrolling="no" width="580" HEIGHT="350"></iframe>
         <%
    else
    UBB_TextArea_Height="200px;"
    UBB_AutoHidden=False
  UBBeditor("Message")
   end if

第三处: 编辑摘要区
原文件:

<%
              if log_editType=0 then
                 Dim oFCKeditor1
                 Set oFCKeditor1 = New FCKeditor
                 oFCKeditor1.BasePath = sBasePath
                 oFCKeditor1.Height="150"
                 oFCKeditor1.ToolbarSet="Basic"
                 oFCKeditor1.Config("AutoDetectLanguage") = False
                 oFCKeditor1.Config("DefaultLanguage")    = "zh-cn"
                 oFCKeditor1.Value = ""
                 oFCKeditor1.Create "log_Intro"
              else
            %>
            <textarea name="log_Intro" class="editTextarea" style="width:99%;height:120px;"></textarea>

更改为:

<%
              if log_editType=0 then
                       %>
                 <input type="hidden" name="log_Intro" id="log_Intro" value="" />
     <iframe ID="eWebEditor2" src="ewebeditor/ewebeditor.htm?id=log_Intro&style=mini" frameborder="0" scrolling="no" width="580" HEIGHT="150"></iframe>
     <%
              else
            %>

第四处: 附件上传区

原文件:
<tr>
              <td align="right" valign="top" nowrap><span style="font-weight: bold">附件上传:</span></td>
              <td colspan="2" align="left"><iframe src="attachment.asp" width="100%" height="24" frameborder="0" scrolling="no" border="0" frameborder="0"></iframe></td>
            </tr>

更改为:
<% if log_editType<>0 then %>
                 <tr>
              <td align="right" valign="top" nowrap><span style="font-weight: bold">附件上传:</span></td>
              <td colspan="2" align="left"><iframe src="attachment.asp" width="100%" height="24" frameborder="0" scrolling="no" border="0" frameborder="0"></iframe></td>
            </tr>
            <%end if%>

b.修改postedit.asp文件,共三处
第一处:

原文件:
if log_editType=0 then
          Dim sBasePath
          sBasePath = "fckeditor/"
          Dim oFCKeditor
          Set oFCKeditor = New FCKeditor
          oFCKeditor.BasePath = sBasePath
          oFCKeditor.Config("AutoDetectLanguage") = False
          oFCKeditor.Config("DefaultLanguage")    = "zh-cn"
          oFCKeditor.Value = UnCheckStr(lArticle.logMessage)
          oFCKeditor.Create "Message"
     else
      UBB_TextArea_Height="200px;"
     UBB_AutoHidden=False
      UBB_Msg_Value=UBBFilter(UnCheckStr(lArticle.logMessage))
      UBBeditor("Message")
    end if

更改为:
if log_editType=0 then %>
    <input type="hidden" name="message" id="message" value="<%=server.HTMLEncode(lArticle.logMessage)%>" />
    <iframe ID="eWebEditor1" src="ewebeditor/ewebeditor.htm?id=message&style=gray" frameborder="0" scrolling="no" width="580" HEIGHT="350"></iframe>
    <%
     else
      UBB_TextArea_Height="200px;"
     UBB_AutoHidden=False
      UBB_Msg_Value=UBBFilter(UnCheckStr(lArticle.logMessage))
      UBBeditor("Message")
    end if

第二处:
原文件:

<%
               if log_editType=0 then
                  Dim oFCKeditor1
                  Set oFCKeditor1 = New FCKeditor
                  oFCKeditor1.BasePath = sBasePath
                  oFCKeditor1.Height="150"
                  oFCKeditor1.ToolbarSet="Basic"
                  oFCKeditor1.Config("AutoDetectLanguage") = False
                  oFCKeditor1.Config("DefaultLanguage")    = "zh-cn"
                  oFCKeditor1.Value = UnCheckStr(lArticle.logIntro)
                  oFCKeditor1.Create "log_Intro"
               else
             %>
             <textarea name="log_Intro" class="editTextarea" style="width:99%;height:120px;"><%=UBBFilter(HTMLDecode(UnCheckStr(lArticle.logIntro)))%></textarea>
             <%
               end if

更该为:
<% if log_editType=0 then %>
                  <input type="hidden" name="log_Intro" id="log_Intro" value="<%=server.HTMLEncode((UnCheckStr(lArticle.logIntro))%>" />
                  <iframe ID="eWebEditor2" src="ewebeditor/ewebeditor.htm?id=log_Intro&style=mini" frameborder="0" scrolling="no" width="580" HEIGHT="150"></iframe><%
               else
             %>
             <textarea name="log_Intro" class="editTextarea" style="width:99%;height:120px;"><%=UBBFilter(HTMLDecode(UnCheckStr(lArticle.logIntro)))%></textarea>
             <%
               end if

第三处:
原文件:

             <tr>
               <td align="right" valign="top" nowrap><span style="font-weight: bold">附件上传:</span></td>
               <td colspan="2" align="left"><iframe src="attachment.asp" width="100%" height="24" frameborder="0" scrolling="no" border="0" frameborder="0"></iframe></td>
             </tr>

更改为:
<% if log_editType<>0 then %>
           <tr>
               <td align="right" valign="top" nowrap><span style="font-weight: bold">附件上传:</span></td>
               <td colspan="2" align="left"><iframe src="attachment.asp" width="100%" height="24" frameborder="0" scrolling="no" border="0" frameborder="0"></iframe></td>
             </tr>
<%end if%>

自己把代码中包含ewebeditor/ewebeditor.htm?id=log_Intro&style=mini字符的修改为自己ewebeditor的路径,和默认的风格...
关于上传文件的路径最好设为attachments文件夹,可以在pj的后台进行附件管理。方法可以参照ewebeditor的使用方法。
到此全部修改结束......
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]