zoukankan      html  css  js  c++  java
  • ecshop 整合 kindedotor

    网上的资料很多 自己记录下 以供使用

    1.上传kiededotor 到 include 目录下

    2.修改 /admin/includes/lib_main.php 的  create_html_editor 函数

    function create_html_editor($input_name, $input_value = '')
    {
        global $smarty;
        /*
        $editor = new FCKeditor($input_name);
        $editor->BasePath   = '../includes/fckeditor/';
        $editor->ToolbarSet = 'Normal';
        $editor->Width      = '100%';
        $editor->Height     = '320';
        $editor->Value      = $input_value;
        $FCKeditor = $editor->CreateHtml();*/
        
    $kindeditor = <<<EOT
    
    <script charset='utf-8' src='/includes/kindeditor/kindeditor-min.js'></script>
        <script>
            var editor;
                KindEditor.ready(function(K) {
                    editor = K.create('textarea[name="$input_name"]', {
                        allowFileManager : true,
                        width : '100%',
                        height: '300px',
                        resizeType: 0   //固定宽高
                    });
                });
        </script>
        <textarea id="$input_name" name="$input_name" style='700px;height:300px;'>$input_value</textarea>
    EOT;
        
    
        
        $smarty->assign('FCKeditor', $kindeditor);
    }

    3.修改 \includes\kindeditor\php\   file_manager_json.php  和upload_json.php  文件 保证图片 浏览上传等功能

    file_manager_json.php 头部文件

    require_once 'JSON.php';
    
    $php_path = dirname(__FILE__) . '/';
    $php_url = dirname($_SERVER['PHP_SELF']) . '/';
    
    //根目录路径,可以指定绝对路径,比如 /var/www/attached/
    $root_path = $php_path . 'http://www.cnblogs.com/../images/upload/';
    //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
    $root_url = $php_url . 'http://www.cnblogs.com/../images/upload/';
    //图片扩展名
    $ext_arr = array('gif', 'jpg', 'jpeg', 'png', 'bmp');

    upload_json.php

    define('IN_ECS', true);
    require_once 'JSON.php';
    require_once 'http://www.cnblogs.com/init.php';
    
    $php_path = dirname(__FILE__) . '/';
    $php_url = dirname($_SERVER['PHP_SELF']) . '/';

    $file_url = $save_url . $new_file_name; 下面添加

    //判断并给符合条件图片加上水印
        if ($file_ext == 'jpg' || $file_ext == 'jpeg' || $file_ext == 'png' || $file_ext == 'gif' || $file_ext == 'bmp' )
        {
            require_once(ROOT_PATH . '/includes/cls_image.php');
            $image = new cls_image($GLOBALS['_CFG']['bgcolor']);
        
            if (intval($GLOBALS['_CFG']['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark']))
            {
            
                $image->add_watermark($file_path,'','http://www.cnblogs.com/'.$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']);
            }
        }
  • 相关阅读:
    显示文件本地文件夹
    Select Dependencies选择依赖项
    搜索小技巧
    783. Minimum Distance Between BST Nodes BST节点之间的最小距离
    5. Longest Palindromic Substring 最长的回文子串
    12. Integer to Roman 整数转罗马数字
    3. Longest Substring Without Repeating Characters 最长的子串不重复字符
    539. Minimum Time Difference 最小时差
    43. Multiply Strings 字符串相乘
    445. Add Two Numbers II 两个数字相加2
  • 原文地址:https://www.cnblogs.com/yxbs/p/2889922.html
Copyright © 2011-2022 走看看