織夢開啟附件遠端同步和縮圖支援同步問題
阿新 • • 發佈:2018-11-03
開啟附件遠端同步
系統-核心,開啟遠端站點和遠端釋出
讓縮圖支援同步和加入附件伺服器域名
1、開啟 /dede/imagecut.php 找到
//對任意裁剪方式再次縮小圖片至限定大小
if($newwidth > $cfg_ddimg_width || $newheight > $cfg_ddimg_height)
{
ImageResize($ddpicokurl, $cfg_ddimg_width, $cfg_ddimg_height);
}
在下面加入
if($cfg_remote_site=='Y' && $remoteuploads == 1) { //啟用遠端站點則建立FTP類 require_once(DEDEINC.'/ftp.class.php'); if(file_exists(DEDEDATA."/cache/inc_remote_config.php")) { require_once DEDEDATA."/cache/inc_remote_config.php"; } if(empty($remoteuploads)) $remoteuploads = 0; if(empty($remoteupUrl)) $remoteupUrl = ''; //初始化FTP配置 $ftpconfig = array( 'hostname'=>$rmhost, 'port'=>$rmport, 'username'=>$rmname, 'password'=>$rmpwd ); $ftp = new FTP; $ftp->connect($ftpconfig); //分析遠端檔案路徑 $remotefile = str_replace(DEDEROOT, '', $ddpicokurl); $localfile = '..'.$remotefile; //建立遠端資料夾 $remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile); $ftp->rmkdir($remotedir); $ftp->upload($localfile, $remotefile); }
繼續找到
require_once(DEDEINC.'/image.func.php');
在它的下面加入
$file = str_replace($remoteupUrl, '', $file);
繼續找到
<?php echo $ddpicok; ?>
改成
<?php if($cfg_remote_site=='Y' && $remoteuploads == 1){echo $remoteupUrl.$ddpicok;}else{echo $ddpicok;} ?>
2、開啟 /include/helpers/upload.helper.php 找到
global $cfg_imgtype, $cfg_softtype, $cfg_mediatype;
在它下面加入
global $cfg_remote_site, $remoteuploads,$remoteupUrl,$rmhost,$rmport,$rmname,$rmpwd;
繼續找到
if($ftype=='image' && $watermark)
{
WaterImg($cfg_basedir.$fileurl, 'up');
}
在它下面加入
if($cfg_remote_site=='Y' && $remoteuploads == 1) { //啟用遠端站點則建立FTP類 require_once(DEDEINC.'/ftp.class.php'); if(file_exists(DEDEDATA."/cache/inc_remote_config.php")) { require_once DEDEDATA."/cache/inc_remote_config.php"; } if(empty($remoteuploads)) $remoteuploads = 0; if(empty($remoteupUrl)) $remoteupUrl = ''; //初始化FTP配置 $ftpconfig = array( 'hostname'=>$rmhost, 'port'=>$rmport, 'username'=>$rmname, 'password'=>$rmpwd ); $ftp = new FTP; $ftp->connect($ftpconfig); //分析遠端檔案路徑 $remotefile = str_replace(DEDEROOT, '', $cfg_basedir.$fileurl); $localfile = '..'.$remotefile; //建立遠端資料夾 $remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile); $ftp->rmkdir($remotedir); $ftp->upload($localfile, $remotefile); }
3、開啟/dede/templets\imagecut.htm 找到
ReturnImg('<?php echo $file; ?>')
改成
ReturnImg('<?php if($cfg_remote_site=='Y' && $remoteuploads == 1){echo $remoteupUrl.$file;}else{echo $file;} ?>')
4、開啟 /dede/archives_do.php 找到
if(!empty($cfg_uplitpic_cut) && $cfg_uplitpic_cut=='N')
在它的下面加入
if($cfg_remote_site=='Y' && $remoteuploads == 1){$upfile = $remoteupUrl.$upfile;}
完成