花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來到素材無憂網(wǎng),按 + 收藏我們
登錄 注冊(cè) 退出 找回密碼

織夢(mèng)模型自定義圖片字段圖片(僅網(wǎng)址)字段支持本地上傳

時(shí)間: 2020-09-15 16:19 閱讀: 作者:素材無憂網(wǎng)

官方后臺(tái)本地上傳效果

織夢(mèng)模型自定義圖片字段圖片(僅網(wǎng)址)字段支持本地上傳(圖1)

Layui框架后臺(tái)本地上傳效果

織夢(mèng)模型自定義圖片字段圖片(僅網(wǎng)址)字段支持本地上傳(圖2)

實(shí)現(xiàn)教程開始

1、打開 /后臺(tái)/js/main.js 找到,大概在110行至151行

function SeePicNew(f, imgdid, frname, hpos, acname)
{
	中間代碼...
}

整個(gè)改成

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 : 'ppicview';
	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+'&ppicview='+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" width="16" height="16" alit="" />上傳中...';
	}
	newobj.style.display = 'block';
	nForm.action = acname;
	nForm.dopost.value = formname;
	nForm.target = '';
}

2、打開 /后臺(tái)/js/album.js 找到,大概在73行至111行

function seePicNewAlb(f, imgdid, frname, hpos, acname)
{
	中間代碼...
}

整個(gè)改成

function seePicNewAlb(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 : 'ppicview';
	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", checkSubmitAlb);
    else nForm.removeEventListener("submit", checkSubmitAlb, false);
	if(picname == 'picname') var picname = 'litpic';
	nForm.action = 'archives_do.php?litpic='+picname+'&picname='+picvalue+'&ppicview='+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" width="16" height="16" alit="" />上傳中...';
	}
	newobj.style.display = 'block';
	nForm.action = acname;
	nForm.dopost.value = formname;
	nForm.target = '';
}

3、打開 /后臺(tái)/archives_do.php 找到,大概在109行至157行

else if($dopost=="uploadLitpic")
{
	中間代碼省略...
}

整個(gè)改成

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('上傳文件失敗,請(qǐng)檢查原因!');
            </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[ppicview]}'))
                    {
                        parent.document.getElementById('{$_GET[ppicview]}').style.width = '150px';
                        parent.document.getElementById('{$_GET[ppicview]}').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]}&p={$_GET[ppicview]}&isupload=yes&file={$upfile}', 'popUpImagesWin', 'scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=150, top=50');
                </script>";
         }
    }
    echo $msg;
    exit();
}

4、打開 /后臺(tái)/imagecut.php 找到

document.form1.picname

有2處,都改成

document.form1.{$f}

繼續(xù)找到

getElementById('ppicview')

有2處,都改成

getElementById('{$p}')

5、打開 /后臺(tái)/templets/imagecut.htm 找到

document.form1.picname

有2處,都改成

document.form1.{$f}

繼續(xù)找到

getElementById('ppicview')

有2處,都改成

getElementById('{$p}')

繼續(xù)找到

<input type="hidden" name="f" value="<?php echo $f;?>" />

在它的下面加入

<input type="hidden" name="p" value="<?php echo $p;?>" />

6、

6-1) 如果你用的是官方默認(rèn)后臺(tái),打開 /include/customfields.func.php 找到,大概在143行

$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300px' class='text' /> <input name='".$fieldname."_bt' type='button' class='inputbut' value='瀏覽...' onClick=\"SelectImage('form1.$fieldname','big')\" />\r\n";

改成

$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 class='litpic_span'><input name='my{$fieldname}' type='file' id='my{$fieldname}' onChange=\"SeePicNew(this, 'pmy{$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' class='inputbut' value='瀏覽...' onClick=\"SelectImageN('form1.$fieldname','big','$fieldname')\" /> <p id='pmy{$fieldname}view' class='ppre' style='display:inline-block;vertical-align:middle'></p>\r\n";

繼續(xù)找到

$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'  class='text' /> <input name='".$fieldname."_bt' class='inputbut' type='button' value='瀏覽...' onClick=\"SelectImage('form1.$fieldname','big')\" />\r\n";

有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 class='litpic_span'><input name='my{$fieldname}' type='file' id='my{$fieldname}' onChange=\"SeePicNew(this, 'pmy{$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' class='inputbut' type='button' value='瀏覽...' onClick=\"SelectImage('form1.$fieldname','big')\" /> <p id='pmy{$fieldname}view' class='ppre' style='display:inline-block;vertical-align:middle'>{$imgstr}</p>\r\n";

6-2) 如果你用的是Layui框架后臺(tái),打開 /include/customfields2.func.php 找到,大概在135行

$innertext = "<input type='text' name='$fieldname' id='$fieldname' class='layui-input' style='float:left;margin-right:-2px;width:300px;' /> <input name='".$fieldname."_bt' type='button' class='layui-btn' value='瀏覽...' onClick=\"SelectImage('form1.$fieldname','big')\" />\r\n";

改成

$innertext = "<input name='{$fieldname}' type='text' id='{$fieldname}' class='layui-input' style='float:left;margin-right:-2px;width:300px;' value='' /><input type='button' class='layui-btn' value='本地上傳' style='cursor:pointer;' /><iframe name='upmy{$fieldname}fra' id='upmy{$fieldname}fra' src='' width='200' height='200' style='display:none'></iframe><span class='litpic_span'><input name='my{$fieldname}' type='file' id='my{$fieldname}' onChange=\"SeePicNew(this, 'pmy{$fieldname}view', 'upmy{$fieldname}fra', 165, '', 'save', 'my{$fieldname}', '{$fieldname}');\" size='1' class='np coolbg' style='cursor:pointer;height:30px;margin-left:-40px;opacity:0;width:85px;'/></span> <input name='".$fieldname."_bt' type='button' class='layui-btn layui-btn-normal' value='站內(nèi)選擇' onClick=\"SelectImageN('form1.$fieldname','big','$fieldname')\" /> <p id='pmy{$fieldname}view' class='ppre'></p>\r\n";

繼續(xù)找到

$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='float:left;margin-right:-2px;width:300px;'  class='layui-input' /> <input name='".$fieldname."_bt' class='layui-btn' type='button' value='瀏覽...' onClick=\"SelectImage('form1.$fieldname','big')\" />\r\n";

有2處,都改成

$imgstr = ($fvalue=='') ? '' : "<img src='{$fvalue}' width='150'>";
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='float:left;margin-right:-2px;width:300px;' class='layui-input' /><input type='button' class='layui-btn' value='本地上傳' style='cursor:pointer;' /><iframe name='upmy{$fieldname}fra' id='upmy{$fieldname}fra' src='' width='200' height='200' style='display:none'></iframe><span class='litpic_span'><input name='my{$fieldname}' type='file' id='my{$fieldname}' onChange=\"SeePicNew(this, 'pmy{$fieldname}view', 'upmy{$fieldname}fra', 165, '', 'save', 'my{$fieldname}', '{$fieldname}');\" size='1' class='np coolbg' style='cursor:pointer;height:30px;margin-left:-40px;opacity:0;width:85px;'/></span> <input name='".$fieldname."_bt' class='layui-btn layui-btn-normal' type='button' value='站內(nèi)選擇' onClick=\"SelectImage('form1.$fieldname','big')\" /> <p id='pmy{$fieldname}view' class='ppre'>{$imgstr}</p>\r\n";

完成后,清空瀏覽器緩存和臨時(shí)文件,重新刷新后臺(tái),測(cè)試效果,如果無效,打開瀏覽器無痕窗口測(cè)試

織夢(mèng)模型自定義圖片字段圖片(僅網(wǎng)址)字段支持本地上傳(圖3)

版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請(qǐng)注明: 織夢(mèng)模型自定義圖片字段圖片(僅網(wǎng)址)字段支持本地上傳

標(biāo)簽:  
相關(guān)文章
模板推薦