帝国cms 后台多图集H5上传插件webupload
本帖最后由 han52036 于 2021-7-26 09:17 编辑最近有个小伙伴正在寻找这个,网上很少有完整版本,要么收费要么不完整,出现各种问题。
这次分享下,顺便也给自己做个笔记。
现在不知道玩帝国CMS的多不多,可以交流下。
来干货
1、将webupload文件放到/e/extend/目录下
2、新建字段uploadimg,将下面的代码放入“输入表单替换html代码”中
3、修改一下两个文件
打开/e/class/qinfofun.php文件找到
if($f=="morepic")//图片集
在下面放入代码
elseif($f=='uploadimg')
{
$add_temp = array(
'msmallpic' => $add['msmalluploadimg'],
'mbigpic' => $add['mbiguploadimg'],
'mpicname'=> $add['muploadimgname'],
'mdelpicid' => $add['mdeluploadimgid'],
'mpicid' => $add['muploadimgid'],
'mpicurl_qz'=> $add['muploadimgurl_qz'],
'msavepic'=> $add['msaveuploadimg'],
'mcreatespic'=> $add['mcreatesuploadimg'],
'msmallpfile'=> $add['msmalluploadimgfile'],
'mbigpfile'=> $add['mbiguploadimgfile'],
);
//设置_FIELS
$_FILES['msmallpfile'] = $_FILES['msmalluploadimgpfile'];
$_FILES['mbigpfile'] = $_FILES['mbiguploadimgpfile'];
$add = array_merge($add,$add_temp);
$value=ReturnMorepicpath($add['msmallpic'],$add['mbigpic'],$add['mpicname'],$add['mdelpicid'],$add['mpicid'],$add,$add['mpicurl_qz'],1,0,intval($add['fstb']));
}
打开/e/class/functions.php文件找到
elseif($f=="morepic")//图片集
在下面放入代码(总共两个位置分别放入)
elseif($f=='uploadimg')
{
$add_temp = array(
'msmallpic' => $add['msmalluploadimg'],
'mbigpic' => $add['mbiguploadimg'],
'mpicname'=> $add['muploadimgname'],
'mdelpicid' => $add['mdeluploadimgid'],
'mpicid' => $add['muploadimgid'],
'mpicurl_qz'=> $add['muploadimgurl_qz'],
'msavepic'=> $add['msaveuploadimg'],
'mcreatespic'=> $add['mcreatesuploadimg'],
'msmallpfile'=> $add['msmalluploadimgpfile'],
'mbigpfile'=> $add['mbiguploadimgpfile'],
);
//设置_FIELS
$_FILES['msmallpfile'] = $_FILES['msmalluploadimgpfile'];
$_FILES['mbigpfile'] = $_FILES['mbiguploadimgpfile'];
$add = array_merge($add,$add_temp);
$value=ReturnMorepicpath($add['msmallpic'],$add['mbigpic'],$add['mpicname'],$add['mdelpicid'],$add['mpicid'],$add,$add['mpicurl_qz'],1,0,intval($add['fstb']));
}
最后新建好文章的图集字段 字段命名为[ uploadimg ]
字段代码
<link rel="stylesheet" type="text/css" href="<?=$public_r?>e/extend/webupload/webuploader.css" />
<link rel="stylesheet" type="text/css" href="<?=$public_r?>e/extend/webupload/style.css" />
<script type="text/javascript" src="<?=$public_r?>e/extend/webupload/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
var mys="<?=$public_r?>e/extend/webupload/up.php";
var myfileNumLimit=5;
var myformData={'classid':'<?=$classid?>','filepass':'<?=$filepass?>'};
</script>
<div id="wrapper">
<div id="container">
<div id="uploader">
<div class="queueList">
<div id="dndArea" class="placeholder<?=$r?' element-invisible':''?>">
<div id="filePicker"></div>
<p>点击选择图片,单次最多可选5张</p>
</div>
<ul class="filelist" id="filelist0">
<?
if($r)
{
$r['uploadimg']=stripSlashes($r);
$picarr=explode("\r\n",$r);
$count=count($picarr);
for($i=0;$i<$count;$i++)
{
$j=$i+1;
$pic=explode("::::::",$picarr[$i]);
$checked=$pic==$r?'checked':'';
$uploadimg.='<li class="delpic courseList">
<p class="title">'.$pic.'</p>
<p class="imgWrap"><img style="width:120px; height:90px;" src="'.$pic.'"><input type="hidden" name="mbiguploadimg[]" value="'.$pic.'" /><input type="hidden" name="msmalluploadimg[]" value="'.$pic.'" /><input type="text" id="muploadimgname" name="muploadimgname[]" value="'.$pic.'" /></p>
<div class="file-panel"><input type="radio" value="'.$pic.'" '.$checked.' name="setTitlepic" class="setTitlepic" />设为封面
</div>
<span class="cancel">删除</span>
<div class="moveud"><a class="moveUpBtn" href="javascript:;"><</a><a class="moveDownBtn" href="javascript:;">></a></div>
</li>';
}
}
echo $uploadimg;
?>
<script>
//设置封面
$(document).on('click', '.setTitlepic', function(){
titlepic=$(this).val();
$("#titlepic").val(titlepic);
});
//动态删除DOM添加的图片
$(document).on('click', 'span.cancel', function(){
$(this).parents('.courseList').remove();
});
//静态DOM设置封面
$(document).on('click', '.setTitlepic', function(){
titlepic=$(this).val();
$("#titlepic").val(titlepic);
});
//静态删除DOM添加的图片
$(document).on('click', 'span.cancel', function(){
$(this).parents('.courseList').remove();
});
$(document).on('click', '.moveDownBtn', function(){
//判断是否有下一个节点
if($(this).parents('.courseList').nextAll().length > 0){
$(this).parents('.courseList').next().after($(this).parents('.courseList').prop('outerHTML'));
$(this).parents('.courseList').remove();
}
}).on('click', '.moveUpBtn', function(){
//判断是否有上一个节点
if($(this).parents('.courseList').prevAll().length > 0){
$(this).parents('.courseList').prev().before($(this).parents('.courseList').prop('outerHTML'));
$(this).parents('.courseList').remove();
}
})
</script>
</ul>
</div>
<div class="statusBar" style="<?=$r?'':'display:none;'?>">
<div class="progress">
<span class="text">0%</span>
<span class="percentage"></span>
</div>
<div class="btns">
<div class="uploadBtn">开始上传</div>
<div id="filePicker2"></div>
</div>
<div class="info"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<?=$public_r?>e/extend/webupload/webuploader.min.js"></script>
<script type="text/javascript" src="<?=$public_r?>e/extend/webupload/upload.js"></script>
<script type="text/javascript">
$(function(){
$("#filelist1").html($("#filelist0").html());
$("#filelist0").remove();
})
</script>
阿里云盘链接:https://www.aliyundrive.com/s/LcMvxM5M7KG
另外不明白 为什么网络上关于帝国CMS的插件少之又少,还收费老贵!!!为什么?
喜欢收藏+点赞走一波~~感谢老铁们了!
8.0要用Plupload了
帝国CMS-王猛:研究了N个组件,最后在Web Uploader和Plupload之间决择,最终选了Plupload组件并且已完成多图上传插件。没有选Web Uploader主要原因是最新下载包是2014年的,没有把中间修复过的发新包,不过Web Uploader确实比较简单实用https://weibo.com/1732788707/KnBAK54yL
adm286 发表于 2021-9-23 10:31
8.0要用Plupload了
帝国CMS-王猛:研究了N个组件,最后在Web Uploader和Plupload之间决择,最终选了Plup ...
8.0出来估计我就已经转行了,我要开始做新能源了,我的15年php,拜拜了 不错不错 支持一波 支持楼主无私分享精品 点赞一个 感谢分享 帝国cms是个好东西,但是好像好久都不更新了 支持楼主无私分享精品 感谢分享! 感谢楼主分享