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

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

織夢發(fā)布圖片到指定遠(yuǎn)程服務(wù)器(文章模型圖集模型)

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

1、進(jìn)入寶塔面板,右側(cè),軟件管理,找到PureFTPd,設(shè)置,配置修改,搜索ForcePassiveIP,去掉它前面的#號,192.168.0.1改成你的外網(wǎng)IP,保存,重啟PureFTPd或者服務(wù)器

2、去系統(tǒng)--點(diǎn)擊服務(wù)器分布/遠(yuǎn)程設(shè)置 開啟并輸入相關(guān)配置

3、文章模型縮略圖和文章內(nèi)容圖片發(fā)布到遠(yuǎn)程服務(wù)器

//1、打開 /dede/article_add.php 找到

//生成HTML

在它上面加入

$row1 = $dsql->GetOne("SELECT * FROM `dede_multiserv_config`");
$isftp = $row1['remoteuploads'];
$ftpurl = $row1['remoteupUrl'];
$ftpconfig = $row1['servinfo'];
$ftpconfig_arr = array();
$ftpconfig_txt = explode('|', $ftpconfig);
foreach($ftpconfig_txt as $str){
	$ftpconfig_arr[] = trim($str);
}

if($isftp == 1){		
	$config = array(
	  'hostname' => $ftpconfig_arr[1],
	  'username' => $ftpconfig_arr[3],
	  'password' => $ftpconfig_arr[4],
	  'port' => $ftpconfig_arr[2],
	  'debug' => 'TRUE'
	);
	$ftps = new FTP(); 
	$ftps->connect($config);
	$row2 = $dsql->GetOne("SELECT litpic FROM `dede_archives` WHERE id=$arcID");
	$imglist = $row2['litpic'];
	$row3 = $dsql->GetOne("SELECT body FROM `$addtable` WHERE aid=$arcID");
	preg_match_all("/<img([^>]*)s*src=('|")([^'"]+)('|")/", $row3['body'], $matches);
	$arr=array_unique($matches[3]);
	foreach($arr as $key){ 
		$imglist .= ','.$key; 
	}
	$imglistarr = array();
	$imglist_txt = explode(',', $imglist);
	foreach($imglist_txt as $str){
		$remotefile = str_replace(DEDEROOT, '', $str);
		$localfile = '..'.$remotefile;
		$remotefile2 = str_replace('uploads/', 'uploadfile/', $remotefile);
		$remotedir = preg_replace('/[^/]*.(jpg|gif|bmp|png)/', '', $remotefile2);
		$ftps->rmkdir($remotedir);
		$ftps->upload($localfile, $remotefile2);
	}
	$dsql->ExecuteNoneQuery("UPDATE `dede_archives` SET `litpic`=REPLACE(`litpic`,'/uploads','$ftpurl/uploadfile') WHERE `litpic` LIKE '%/uploads%' AND `id` = $arcID");
	$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET `body`=REPLACE(`body`,'/uploads','$ftpurl/uploadfile') WHERE `body` LIKE '%/uploads%' AND `aid` = $arcID");
	$ftps->close();
}

2、打開 /dede/article_edit.php 找到

//生成HTML

在他的上面加入

$row1 = $dsql->GetOne("SELECT * FROM `dede_multiserv_config`");
$isftp = $row1['remoteuploads'];
$ftpurl = $row1['remoteupUrl'];
$ftpconfig = $row1['servinfo'];
$ftpconfig_arr = array();
$ftpconfig_txt = explode('|', $ftpconfig);
foreach($ftpconfig_txt as $str){
	$ftpconfig_arr[] = trim($str);
}

if($isftp == 1){
	$config = array(
	  'hostname' => $ftpconfig_arr[1],
	  'username' => $ftpconfig_arr[3],
	  'password' => $ftpconfig_arr[4],
	  'port' => $ftpconfig_arr[2],
	  'debug' => 'TRUE'
	);
	$ftps = new FTP(); 
	$ftps->connect($config);
	
	$row2 = $dsql->GetOne("SELECT litpic FROM `dede_archives` WHERE id=$id");
	$imglist = $row2['litpic'];
	$row3 = $dsql->GetOne("SELECT body FROM `$addtable` WHERE aid=$id");
	preg_match_all("/<img([^>]*)s*src=('|")([^'"]+)('|")/", $row3['body'], $matches);
	$arr=array_unique($matches[3]);
	foreach($arr as $key){ 
		$imglist .= ','.$key; 
	}
	$imglistarr = array();
	$imglist_txt = explode(',', $imglist);
	foreach($imglist_txt as $str){
		if(preg_match('/uploads/', $str)){
			$remotefile = str_replace(DEDEROOT, '', $str);
			$localfile = '..'.$remotefile;
			$remotefile2 = str_replace('uploads/', 'uploadfile/', $remotefile);
			$remotedir = preg_replace('/[^/]*.(jpg|gif|bmp|png)/', '', $remotefile2);
			$ftps->rmkdir($remotedir);
			$ftps->upload($localfile, $remotefile2);
		}
	}
	$dsql->ExecuteNoneQuery("UPDATE `dede_archives` SET `litpic`=REPLACE(`litpic`,'/uploads','$ftpurl/uploadfile') WHERE `litpic` LIKE '%/uploads%' AND `id` = $id");
	$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET `body`=REPLACE(`body`,'/uploads','$ftpurl/uploadfile') WHERE `body` LIKE '%/uploads%' AND `aid` = $id");
	$ftps->close();
}

圖集模型縮略圖和文章內(nèi)容圖片發(fā)布到遠(yuǎn)程服務(wù)器

1、打開 /dede/album_add.php 找到

//生成HTML

在它上面加入

$row1 = $dsql->GetOne("SELECT * FROM `dede_multiserv_config`");
$isftp = $row1['remoteuploads'];
$ftpurl = $row1['remoteupUrl'];
$ftpconfig = $row1['servinfo'];
$ftpconfig_arr = array();
$ftpconfig_txt = explode('|', $ftpconfig);
foreach($ftpconfig_txt as $str){
	$ftpconfig_arr[] = trim($str);
}

if($isftp == 1){
	$config = array(
	  'hostname' => $ftpconfig_arr[1],
	  'username' => $ftpconfig_arr[3],
	  'password' => $ftpconfig_arr[4],
	  'port' => $ftpconfig_arr[2],
	  'debug' => 0
	);
	$ftps = new FTP(); 
	$ftps->connect($config);
	$row2 = $dsql->GetOne("SELECT litpic FROM `dede_archives` WHERE id=$arcID");
	$imglist = $row2['litpic'];
	$row3 = $dsql->GetOne("SELECT imgurls FROM `$addtable` WHERE aid=$arcID");
	$imgurls = $row3['imgurls'];
	if($imgurls != '')
	{
		$dtp = new DedeTagParse();
		$dtp->LoadSource($imgurls);
		$images = array();
		if(is_array($dtp->CTags))
		{
			foreach($dtp->CTags as $ctag)
			{
				if($ctag->GetName() == 'img')
				{
					$imglist .= ','.trim($ctag->GetInnerText());
				}
			}
		}
		$dtp->Clear();
	}

	$imglistarr = array();
	$imglist_txt = explode(',', $imglist);
	
	foreach($imglist_txt as $str){
		$remotefile = str_replace(DEDEROOT, '', $str);
		$localfile = '..'.$remotefile;
		$remotefile2 = str_replace('uploads/', 'uploadfile/', $remotefile);
		$remotedir = preg_replace('/[^/]*.(jpg|gif|bmp|png)/', '', $remotefile2);
		$ftps->rmkdir($remotedir);
		$ftps->upload($localfile, $remotefile2);
	}
	$dsql->ExecuteNoneQuery("UPDATE `dede_archives` SET `litpic`=REPLACE(`litpic`,'/uploads','$ftpurl/uploadfile') WHERE `litpic` LIKE '%/uploads%' AND `id` = $arcID");
	$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET `imgurls`=REPLACE(`imgurls`,'/uploads','$ftpurl/uploadfile') WHERE `imgurls` LIKE '%/uploads%' AND `aid` = $arcID");
	$ftps->close();
}

 

2、打開 /dede/album_edit.php 找到

//生成HTML

在它上面加入

$row1 = $dsql->GetOne("SELECT * FROM `dede_multiserv_config`");
$isftp = $row1['remoteuploads'];
$ftpurl = $row1['remoteupUrl'];
$ftpconfig = $row1['servinfo'];
$ftpconfig_arr = array();
$ftpconfig_txt = explode('|', $ftpconfig);
foreach($ftpconfig_txt as $str){
	$ftpconfig_arr[] = trim($str);
}

if($isftp == 1){		
	$config = array(
	  'hostname' => $ftpconfig_arr[1],
	  'username' => $ftpconfig_arr[3],
	  'password' => $ftpconfig_arr[4],
	  'port' => $ftpconfig_arr[2],
	  'debug' => 0
	);
	$ftps = new FTP(); 
	$ftps->connect($config);
	
	$row2 = $dsql->GetOne("SELECT litpic FROM `dede_archives` WHERE id=$id");
	$imglist = $row2['litpic'];
	$row3 = $dsql->GetOne("SELECT imgurls FROM `$addtable` WHERE aid=$id");
	$imgurls = $row3['imgurls'];
	if($imgurls != '')
	{
		$dtp = new DedeTagParse();
		$dtp->LoadSource($imgurls);
		$images = array();
		if(is_array($dtp->CTags))
		{
			foreach($dtp->CTags as $ctag)
			{
				if($ctag->GetName() == 'img')
				{
					$imglist .= ','.trim($ctag->GetInnerText());
				}
			}
		}
		$dtp->Clear();
	}

	$imglistarr = array();
	$imglist_txt = explode(',', $imglist);
	foreach($imglist_txt as $str){
		if(preg_match('/uploads/', $str)){
			$remotefile = str_replace(DEDEROOT, '', $str);
			$localfile = '..'.$remotefile;
			$remotefile2 = str_replace('uploads/', 'uploadfile/', $remotefile);
			$remotedir = preg_replace('/[^/]*.(jpg|gif|bmp|png)/', '', $remotefile2);
			$ftps->rmkdir($remotedir);
			$ftps->upload($localfile, $remotefile2);
		}
	}
	$dsql->ExecuteNoneQuery("UPDATE `dede_archives` SET `litpic`=REPLACE(`litpic`,'/uploads','$ftpurl/uploadfile') WHERE `litpic` LIKE '%/uploads%' AND `id` = $id");
	$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET `imgurls`=REPLACE(`imgurls`,'/uploads','$ftpurl/uploadfile') WHERE `imgurls` LIKE '%/uploads%' AND `aid` = $id");
	$ftps->close();
}

 

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

轉(zhuǎn)載請注明: 織夢發(fā)布圖片到指定遠(yuǎn)程服務(wù)器(文章模型圖集模型)

相關(guān)文章
模板推薦