首页 > CMS > 织梦DEDE > 正文

dedeCMS缩略图变成/www/wwwroot/这样的链接格式的解决教程

2024-07-12 09:06:15
字体:
来源:转载
供稿:网友

只要将inc/inc_archives_functions.php

查看源码打印代码帮助/** *  获得缩略图 * * @access    public * @param     string  $litpic  缩略图 * @param     string  $picname  图片名称 * @param     string  $isremote  是否远程 * @return    string */function GetDDImage($litpic, $picname, $isremote){    global $cuserLogin,$cfg_ddimg_width,$cfg_ddimg_height,$cfg_basedir,$ddcfg_image_dir,$cfg_addon_savetype;    $ntime = time();    if( ($litpic != 'none' || $litpic != 'ddfirst') &&     !empty($_FILES[$litpic]['tmp_name']) && is_uploaded_file($_FILES[$litpic]['tmp_name']))    {        //如果用户自行上传缩略图        $istype = 0;        $sparr = Array("image/pjpeg", "image/jpeg", "image/gif", "image/png");        $_FILES[$litpic]['type'] = strtolower(trim($_FILES[$litpic]['type']));        if(!in_array($_FILES[$litpic]['type'], $sparr))        {            ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!","-1");            exit();        }        $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);        CreateDir($savepath);        $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));        if(strtolower($_FILES[$litpic]['type']) == "image/gif")        {            $fullUrl = $fullUrl.".gif";        }        else if(strtolower($_FILES[$litpic]['type']) == "image/png")        {            $fullUrl = $fullUrl.".png";        }        else        {            $fullUrl = $fullUrl.".jpg";        }        @move_uploaded_file($_FILES[$litpic]['tmp_name'], $cfg_basedir.$fullUrl);        $litpic = $fullUrl;        if($GLOBALS['cfg_ddimg_full']=='Y') @ImageResizeNew($cfg_basedir.$fullUrl,$cfg_ddimg_width,$cfg_ddimg_height);        else @ImageResize($cfg_basedir.$fullUrl,$cfg_ddimg_width,$cfg_ddimg_height);                $img = $cfg_basedir.$litpic;    }    else    {        $picname = trim($picname);        if($isremote==1 && preg_match("#^http://#i", $picname))        {            $litpic = $picname;            $ddinfos = GetRemoteImage($litpic, $cuserLogin->getUserID());            if(!is_array($ddinfos))            {                $litpic = '';            }            else            {                $litpic = $ddinfos[0];                if($ddinfos[1] > $cfg_ddimg_width || $ddinfos[2] > $cfg_ddimg_height)                {                    if($GLOBALS['cfg_ddimg_full']=='Y') @ImageResizeNew($cfg_basedir.$litpic,$cfg_ddimg_width,$cfg_ddimg_height);                    else @ImageResize($cfg_basedir.$litpic,$cfg_ddimg_width,$cfg_ddimg_height);                }            }        }        else        {            if($litpic=='ddfirst' && !preg_match("#^http://#i", $picname))            {                $oldpic = $cfg_basedir.$picname;                $litpic = str_replace('.', '-lp.', $picname);                if($GLOBALS['cfg_ddimg_full']=='Y') @ImageResizeNew($oldpic,$cfg_ddimg_width,$cfg_ddimg_height,$cfg_basedir.$litpic);                else@ImageResize($oldpic,$cfg_ddimg_width,$cfg_ddimg_height,$cfg_basedir.$litpic);                if(!is_file($cfg_basedir.$litpic)) $litpic = $oldpic;            }            else            {                $litpic = $picname;                return $litpic;            }        }    }    if($litpic=='litpic' || $litpic=='ddfirst') $litpic = '';    return $litpic;}

 

 

里面的$cfg_basedir.全部替换掉就行了

 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表