zoukankan      html  css  js  c++  java
  • 织梦开启附件远程同步和缩略图支持同步问题

    开启附件远程同步

    系统-核心,开启远程站点和远程发布

    让缩略图支持同步和加入附件服务器域名

    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/templetsimagecut.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;}

    完成

  • 相关阅读:
    struts2 标签
    Ubutu命令 笔记积累
    虚拟机VirtualBox和Ubutu
    更新PostgreSQL数据
    向PostgreSQL插入数据
    PostgreSQL表依赖性跟踪
    PostgreSQL外部数据
    PostgreSQL分区介绍
    PostgreSQL继承详解
    PostgreSQL模式介绍
  • 原文地址:https://www.cnblogs.com/dedehtml/p/9902111.html
Copyright © 2011-2022 走看看