相關關鍵詞
關于我們
最新文章
Fckeditor增加圖片水印功能
一個網站系統采用FCKeditor編輯器,此編輯器沒有水印功能,網站系統本身自帶水印功能,但是編輯器里面沒有上傳圖片加水印功能?,F計劃增加水印功能。
1、語言文件set_picture.lang.php
'watermark' => array(
'水印添加條件:','上傳圖片小于該規(guī)格將不添加水印',
'水印類型:','圖片水印','文字水印','文字水印需 FreeType 支持',
'水印文件:','水印添加位置:',
'1.頂部居左','2.頂部居中','3.頂部居右','4.左邊居中','5.圖片中心','6.右邊居中','7.底部居左','8.底部居中','9.底部居右',
'水印位于圖片上的位置 (3x3,共 9 個位置可選)',
'水印偏移調整:','橫向','縱向','Px','調節(jié)水印偏移位置,可以填寫負數',
'水印文字字體:','位于 fonts 目錄下的字體文件',
'水印文字顏色:','字體顏色',
'水印文字:','如果含有中文請選擇支持中文的字體文件',
'字體大?。?#39;,'設置文字水印字體大小',
'文字旋轉角度:','設置文字水印旋轉角度',
'編輯器加水印:','開','關','編輯器里上傳的圖片是否添加水印',
),
紅色增加部分
2、后臺圖片剪裁水印配置文件 set_picture.dwt
<tr>
<td class="name">{:$lang['page']['watermark'][33]:}</td>
<td>
<input name="watermark[editor]" type="radio" value="1" {:if $mle['picture_config']['watermark']['editor'] == '1':}checked="checked"{:/if:} /> {:$lang['page']['watermark'][34]:}
<input name="watermark[editor]" type="radio" value="0" {:if $mle['picture_config']['watermark']['editor'] == '0':}checked="checked"{:/if:} /> {:$lang['page']['watermark'][35]:}
</td>
<td class="field">{:$lang['page']['watermark'][36]:}</td>
</tr>
約90行后增加
3、編輯器文件增加部分
\inc\tools\ckeditor\core\connector\php\php4\CommandHandler\FileUpload.php
\inc\tools\ckeditor\core\connector\php\php5\CommandHandler\FileUpload.php
//樂道修改 編輯器增加水印功能
$type = CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
if($type =='jpg' || $type =='gif' || $type =='png' ){
global $picture_config;
defined('MLEROOT') or define('MLEROOT',str_replace('tools/ckeditor/core/connector/php/php5/CommandHan','',str_replace('\\','/',substr(dirname(__FILE__),0,-4))));
defined('MLEINC') or define('MLEINC',MLEROOT);
require_once(MLEROOT.'class/picture.class.php');
$pics = new picture();
$pics->watermark['file'] = $sFilePath;
$pics->watermark['pics'] = str_replace('../','../../../../../../',$pics->watermark['pics']);
$pics->watermark['font_file'] = str_replace('../','../../../../../../',$pics->watermark['font_file']);
if($picture_config['watermark']['editor']){
$pics->watermark() === true or $pic_info = $pics->info;
}
}
//樂道修改 編輯器增加水印功能結束