相關(guān)關(guān)鍵詞
關(guān)于我們
最新文章
- PHP中opcode緩存簡單用法分析
- thinkPHP控制器變量在模板中的顯示方法示例
- PHP move_uploaded_file() 函數(shù)(將上傳的文件移動(dòng)到新位置)
- dirname(__FILE__)的含義和應(yīng)用說明
- thinkPHP5框架實(shí)現(xiàn)分頁查詢功能的方法示例
- PHP中單雙號與變量
- PHP獲得當(dāng)日零點(diǎn)時(shí)間戳的方法分析
- Laravel ORM對Model::find方法進(jìn)行緩存示例詳解
- PHP讀寫文件高并發(fā)處理操作實(shí)例詳解
- 【CLI】利用Curl下載文件實(shí)時(shí)進(jìn)度條顯示的實(shí)現(xiàn)
Fckeditor增加圖片水印功能
一個(gè)網(wǎng)站系統(tǒng)采用FCKeditor編輯器,此編輯器沒有水印功能,網(wǎng)站系統(tǒng)本身自帶水印功能,但是編輯器里面沒有上傳圖片加水印功能?,F(xiàn)計(jì)劃增加水印功能。
1、語言文件set_picture.lang.php
'watermark' => array(
'水印添加條件:','上傳圖片小于該規(guī)格將不添加水印',
'水印類型:','圖片水印','文字水印','文字水印需 FreeType 支持',
'水印文件:','水印添加位置:',
'1.頂部居左','2.頂部居中','3.頂部居右','4.左邊居中','5.圖片中心','6.右邊居中','7.底部居左','8.底部居中','9.底部居右',
'水印位于圖片上的位置 (3x3,共 9 個(gè)位置可選)',
'水印偏移調(diào)整:','橫向','縱向','Px','調(diào)節(jié)水印偏移位置,可以填寫負(fù)數(shù)',
'水印文字字體:','位于 fonts 目錄下的字體文件',
'水印文字顏色:','字體顏色',
'水印文字:','如果含有中文請選擇支持中文的字體文件',
'字體大小:','設(shè)置文字水印字體大小',
'文字旋轉(zhuǎn)角度:','設(shè)置文字水印旋轉(zhuǎn)角度',
'編輯器加水?。?#39;,'開','關(guān)','編輯器里上傳的圖片是否添加水印',
),
紅色增加部分
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;
}
}
//樂道修改 編輯器增加水印功能結(jié)束