猎凡网络承接仿站、网站定制业务,诚邀您的合作! 猎凡网为你提供:dedecms织梦仿站帝国cms仿站网站定制、企业仿站等服务,欢迎您的访问!
<
>
当前位置: 首页 > 仿站知识

织梦模板让模型里的图片字段支持本地上传的办法

时间:2019-09-07 15:00:03  来源:admin  作者:猎凡网络

织梦让模型里的图片字段支持本地上传效果
 织梦让模型里的图片字段支持本地上传效果   
修改教程
1、打开 dedejsmain.js 找到
function SeePicNew(f, imgdid, frname, hpos, acname)
{
中间代码...
}
把这整个函数改成

function SeePicNew(f, imgdid, frname, hpos, acname, formname, picname, picvalue){var formname = formname ? formname : 'save';var picname = picname ? picname : 'picname';var picvalue = picvalue ? picvalue : 'picname';var imgdid = imgdid ? imgdid : 'divpicview';var newobj = null;if(f.value=='') return ;vImg = $Obj(imgdid);picnameObj = document.getElementById(picname);nFrame = $Nav()=='IE' ? eval('document.frames.'+frname) : $Obj(frname);nForm = f.form;if(nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmit);else nForm.removeEventListener("submit", checkSubmit, false);if(picname == 'picname') var picname = 'litpic';nForm.action = 'archives_do.php?litpic='+picname+'&picname='+picvalue+'&divpicview='+imgdid;nForm.target = frname;nForm.dopost.value = 'uploadLitpic';nForm.submit();picnameObj.value = '';newobj = $Obj('uploadwait');if(!newobj){newobj = document.createElement("DIV");newobj.id = 'uploadwait';newobj.style.position = 'absolute';newobj.className = 'uploadwait';newobj.style.width = 120;newobj.style.height = 20;newobj.style.top = hpos;newobj.style.left = 100;newobj.style.display = 'block';document.body.appendChild(newobj);newobj.innerHTML = '<img src="images/loadinglit.gif" alt="织梦模板让模型里的图片字段支持本地上传的办法" width="16" height="16" alit="" />上传中...';}newobj.style.display = 'block';nForm.action = acname;nForm.dopost.value = formname;nForm.target = '';}2、打开 dedearchives_do.php 找到else if($dopost=="uploadLitpic"){

中间代码省略...
}
 
整个改成

else if($dopost=="uploadLitpic"){$fname = $_GET['litpic'] ? $_GET['litpic'] : 'litpic';    $upfile = AdminUpload($fname, 'imagelit', 0, true );    if($upfile=='-1')    {        $msg = "<script language='javascript'>                parent.document.getElementById('uploadwait').style.display = 'none';                alert('你没指定要上传的文件或文件大小超过限制!');            </script>";    }    else if($upfile=='-2')    {        $msg = "<script language='javascript'>                parent.document.getElementById('uploadwait').style.display = 'none';                alert('上传文件失败,请检查原因!');            </script>";    }    else if($upfile=='0')    {        $msg = "<script language='javascript'>                parent.document.getElementById('uploadwait').style.display = 'none';                alert('文件类型不正确!');            </script>";    }    else    {         if(!empty($cfg_uplitpic_cut) && $cfg_uplitpic_cut=='N')         {                 $msg = "<script language='javascript'>                    parent.document.getElementById('uploadwait').style.display = 'none';                    parent.document.getElementById('{$_GET[picname]}').value = '{$upfile}';                    if(parent.document.getElementById('{$_GET[divpicview]}'))                    {                        parent.document.getElementById('{$_GET[divpicview]}').style.width = '150px';                        parent.document.getElementById('{$_GET[divpicview]}').innerHTML = "<img src='{$upfile}?n' width='150' />";                    }                </script>";         }         else         {               $msg = "<script language='javascript'>                    parent.document.getElementById('uploadwait').style.display = 'none';                    window.open('imagecut.php?f={$_GET[picname]}&isupload=yes&file={$upfile}', 'popUpImagesWin', 'scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=150, top=50');                </script>";         }    }    echo $msg;    exit();}

3、打开 includecustomfields.func.php 找到
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300px' /> <input name='".$fieldname."_bt' type='button' value='浏览...' onClick="SelectImage('form1.$fieldname','big')" />rn";
 
改成
$innertext = "<input name='{$fieldname}' type='text' id='{$fieldname}' style='width:300px' value='' /><input type='button'  value='
本地上传
' style='width:70px;cursor:pointer;' /><iframe name='upmy{$fieldname}fra' id='upmy{$fieldname}fra' src='' width='200' height='200' style='display:none'></iframe><span><input name='my{$fieldname}' type='file' id='my{$fieldname}' onChange="SeePicNew(this, 'divmy{$fieldname}view', 'upmy{$fieldname}fra', 165, '', 'save', 'my{$fieldname}', '{$fieldname}');" size='1' class='np coolbg' style='cursor:pointer;height:20px;margin-left:-20px;opacity:0;width:85px;'/></span> <input name='".$fieldname."_bt' type='button' value='
浏览
...' onClick="SelectImageN('form1.$fieldname','big','$fieldname')" /> <div id='divmy{$fieldname}view' style='display:inline-block;vertical-align:middle'></div>rn";
继续找到
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'  class='text' /> <input name='".$fieldname."_bt' type='button' value='浏览...' onClick="SelectImage('form1.$fieldname','big')" />rn";
 
有2处,都改成
$imgstr = ($fvalue=='') ? '' : "<img src='{$fvalue}' width='150'>";
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'  class='text' /><input type='button'  value='本地上传' style='width:70px;cursor:pointer;' /><iframe name='upmy{$fieldname}fra' id='upmy{$fieldname}fra' src='' width='200' height='200' style='display:none'></iframe><span><input name='my{$fieldname}' type='file' id='my{$fieldname}' onChange="SeePicNew(this, 'divmy{$fieldname}view', 'upmy{$fieldname}fra', 165, '', 'save', 'my{$fieldname}', '{$fieldname}');" size='1' class='np coolbg' style='cursor:pointer;height:20px;margin-left:-20px;opacity:0;width:85px;'/></span> <input name='".$fieldname."_bt' type='button' value='浏览...' onClick="SelectImage('form1.$fieldname','big')" /> <div id='divmy{$fieldname}view' style='display:inline-block;vertical-align:middle'>{$imgstr}</div>rn";
完结。

<

本文网址:https://fangzhan.seobr.com/news/109.html
本文由猎凡仿站网发布,如果您还想了解更多关于网站仿制的文章,请点击查看 仿站知识 的其它文章,转发请注明来源及版权归属。
承接以下业务:传统网站改自适应网站、网站增加手机站、网站改全屏网站改大屏展示、GBK转UFT-8、DEDECMS转WORDPRESS、网站站群制作、企业网站设计、企业网站优化、网站托管等业务

标签:上传   字段
相关文章

推荐资讯
热点标签

数年专注于仿站建站,擅长dedecms仿站、WORDPRESS仿站、帝国cms仿站、网站改版等业务! Copyright©2019 猎凡仿站网 All Rights Reserved