1.需要在织梦->系统->系统基本参数->添加新变量
是否开启图片域名 1开启 0关闭
cfg_oss_imagesed 1
图片域名路径
cfg_oss_images_host http://s1.hgcang.com/bsimg
2.修改把图片上传到ftp
路径:cms/include/dialog/select_images_post.php line:64
从原有的
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '', $fullfilename);
$localfile = '../..'.$remotefile;
//创建远程文件夹
$remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile);
$ftp->rmkdir($remotedir);
$ftp->upload($localfile, $remotefile);
}
改为
if($cfg_oss_imagesed) {
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 = '';
$config = array(
'hostname' => $GLOBALS['cfg_ftp_host'],
'username' => $GLOBALS['cfg_ftp_user'],
'password' => $GLOBALS['cfg_ftp_pwd'],
'passive' => 'TRUE',
'debug' => 'TRUE'
);
$ftp = new FTP($config);
$ftp->connect();
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '', $fullfilename);
$localfile = '../..' . $remotefile;
//创建远程文件夹
$remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile);
$ftp->rmkdir($remotedir);
$ftp->upload($localfile, $remotefile);
@unlink($localfile);
} else {
/**************/
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '', $fullfilename);
$localfile = '../..'.$remotefile;
//创建远程文件夹
$remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile);
$ftp->rmkdir($remotedir);
$ftp->upload($localfile, $remotefile);
}
}
3.修改显示图片路径
路径:cms/include/dialog/select_images_post.php line:108
从原有的
$fileurl = $activepath.'/'.$filename;
改为
$fileurl = ($cfg_oss_imagesed ? $cfg_oss_images_host : '') . '/' . ltrim($activepath , '/') .'/'.$filename;