• Kindeditor单独调用多图上传


    html代码:

    <input type="button" id="J_selectImage" value="图片上传" />
    <div id="J_imageView">
    <?php foreach($imgs as $row):?>
    <div class="img_view"><img class='iYuUpload-View' src='/Uploads/<?php echo $row['file_url'];?>'/><span class="view_del"id="<?=$row["id"]?>"><img delTarget="p_<?=$row['id']?>" src="/Public/Home/img/close_delete_2.png"></span></div>

    <input type='hidden' thumbID="p_<?=$row['id']?>" value='<?=$row['thumbnail_url']?>' name='thumbPath[]' >
    <input type='hidden' thumbID="p_<?=$row['id']?>" value='<?=$row['file_url']?>' name='imagePath[]'>
    <?php endforeach;?>
    </div>  

    JS代码:

    <script>
    function clearUploadPic(i,obj){
    $("input[preImagePathId="+i+"]").val("");
    $("input[preThumbPathId="+i+"]").val("");
    obj.remove();
    }
    KindEditor.ready(function(K) {
    window.editor = K.create('#editor_id', {
    height:'500px',
    uploadJson: '<?=u('Upload/editorUpload?uid='.cookie('uid'))?>',
    items : [
    'source','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
    'insertunorderedlist', '|', 'image']

    });



    K('#J_selectImage').click(function() {
    editor.loadPlugin('multiimage', function() {
    editor.plugin.multiImageDialog({
    clickFn : function(urlList) {
    var div = K('#J_imageView');
    //div.html('');
    K.each(urlList, function(i, data) {

    div.append('<div class="img_view"><img src="' + data.url + '"><span class="view_del" onclick="clearUploadPic('+i+',$(this).parent())"><img src="/Public/Home/img/close_delete_2.png"></span></div>');
    div.append('<input preImagePathId="'+i+'" name="imagePath[]" class="image-path" type="hidden" value="' + data.url +'">');
    div.append('<input preThumbPathId="'+i+'" name="thumbPath[]" class="thumb-path" type="hidden" value="' + data.mini_url + '">');
    //$("#thumbPath").val($("#thumbPath").val()+""+ data.mini_url);
    });
    editor.hideDialog();
    }
    });
    });
    });
    })

    </script>

  • 相关阅读:
    LeetCode212. Word Search II
    LeetCode132. Palindrome Partitioning II
    LeetCode239. Sliding Window Maximum
    LeetCode解题报告—— Interleaving String
    LeetCode解题报告—— Maximal Rectangle
    LeetCode解题报告—— Minimum Window Substring && Largest Rectangle in Histogram
    LeetCode解题报告—— N-Queens && Edit Distance
    LeetCode解题报告—— Trapping Rain Water
    在CentOS上安装第三方软件库EPEL
    lunix存取windows共享文件夹
  • 原文地址:https://www.cnblogs.com/lovelh/p/7256788.html
Copyright © 2020-2023  润新知