<input type="button" value="图片上传" /> <div> <?php foreach($imgs as $row):?> <div><img src='/Uploads/<?php echo $row['file_url'];?>'/><spanid="<?=$row["id"]?>"><img delTarget="p_<?=$row['id']?>" src="https://www.jb51.net/Public/Home/img/close_delete_2.png"></span></div> <input type='hidden' thumbID="p_<?=$row['id']?>" value='<?=$row['thumbnail_url']?>' > <input type='hidden' thumbID="p_<?=$row['id']?>" value='<?=$row['file_url']?>'> <?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><img src="' + data.url + '"><span><img src="https://www.jb51.net/Public/Home/img/close_delete_2.png"></span></div>'); div.append('<input preImagePathId="'+i+'" type="hidden" value="' + data.url +'">'); div.append('<input preThumbPathId="'+i+'" type="hidden" value="' + data.mini_url + '">'); //$("#thumbPath").val($("#thumbPath").val()+""+ data.mini_url); }); editor.hideDialog(); } }); }); }); }) </script>
以上这篇Kindeditor单独调用多图上传实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
您可能感兴趣的文章: