<tr id="aqack"><sup id="aqack"></sup></tr>
<tr id="aqack"><sup id="aqack"></sup></tr>
<legend id="aqack"></legend>
  • <legend id="aqack"><input id="aqack"></input></legend>
  • <tr id="aqack"><code id="aqack"></code></tr>
  • <tr id="aqack"><input id="aqack"></input></tr>
    <legend id="aqack"><input id="aqack"></input></legend>
    <legend id="aqack"><sup id="aqack"></sup></legend>
  • 免费发布网络营销推广信息 推广 热搜: 新纪元期货  HFRR  科技信息数码  仪器 

    织梦dede添加iframe视频内容变图片的解决方法

       日期:2022-04-08     浏览:566    评论:0     买帖  | 修改  | 投诉  | 刷新

    织梦dede后台文章添加iframe视频内容保存文章后,iframe就变成了图片链接。

    解决方法

     

     

    添加文章时 添加优酷视频 :<iframe height=498 width=510 src='http://player.youku.com/embed/XNDAzNTAzODE4OA==' frameborder=0 'allowfullscreen'></iframe

    提交后被替换成 

     

    <iframe frameborder="0" height="498" src=http://www.meaw.cn/skin/default/image/nopic.gif width="510"></iframe>

     

    经测试,发现问题出在保存之前对body内容的处理上 

     

    打开 dede\inc\inc_archives_functions.PHP 找到

    preg_match_all("/src=http://www.meaw.cn/skin/default/image/nopic.gif'|\s]([^\"|^\'|^\s]*?)/isU",$body,$img_array);

    改成

    preg_match_all("/<img.*?src=http://www.meaw.cn/skin/default/image/nopic.gif'|\s]([^\"|^\'|^\s]*?)/isU",$body,$img_array);

    保存,完成,重新插入iframe代码试试。

     

    另外的方法:

    //远程图片本地化
    if($remote==1)
    {
        $body = GetCurContent($body);   //dede/inc/inc_archives_functions.php 644行  
    }

     

     

    把函数GetCurContent做如下修改可暂时解决(未侧式是否会引起其他问题,应该把所有的图片格式都枚举出来)

     

    
    function GetCurContent($body)
    {
        global $cfg_multi_site,$cfg_basehost,$cfg_basedir,$cfg_image_dir,$arcID,$cuserLogin,$dSQL;
        $cfg_uploaddir = $cfg_image_dir;
        $htd = new DedeHttpDown();
        $basehost = "http://".$_SERVER["HTTP_HOST"];
        $img_array = array();
        preg_match_all("/src=http://www.meaw.cn/skin/default/image/nopic.gif'|\s]([^\"|^\'|^\s]*?)/isU",$body,$img_array);
        
        $img_array = array_unique($img_array[1]);
        $imgUrl = $cfg_uploaddir.'/'.MyDate("ymd", time());
        $imgPath = $cfg_basedir.$imgUrl;
        if(!is_dir($imgPath.'/'))
        {
            MkdirAll($imgPath, $GLOBALS['cfg_dir_purview']);
            CloseFtp();
        }
        $milliSecond = MyDate('His',time());
        foreach($img_array as $key=>$value)
        {
            if(preg_match("#".$basehost."#i", $value))
            {
                continue;
            }
            if($cfg_basehost != $basehost && preg_match("#".$cfg_basehost."#i", $value))
            {
                continue;
            }
            if(!preg_match("#^(http|https):\/\/#i", $value))
            {
                continue;
            }
            $htd->OpenUrl($value);
            $itype = $htd->GetHead("content-type");
            $itype = substr($value, -4, 4);
            if(!preg_match("#\.(jpg|gif|png)#i", $itype))
            {
                if($itype=='image/gif')
                {
                    $itype = ".gif";
                }
                else if($itype=='image/png')
                {
                    $itype = ".png";
                }else if($itype=='image/jpg'){  //不知道jpeg格式的是否一样,如果不一样还得增加jpeg判断
                    $itype = '.jpg';
                }
                else
                {
                    continue;  //原函数未处理没有后缀名的情况,应该在这里判断视频或者。。。。。。,这样写将不再解析除了 gif png jpg 以外的图片格式,如 bmp
                }
            }
            $milliSecondN = dd2char($milliSecond.mt_rand(1000, 8000));
            $value = trim($value);
            $rndFileName = $imgPath.'/'.$milliSecondN.'-'.$key.$itype;
            $fileurl = $imgUrl.'/'.$milliSecondN.'-'.$key.$itype;
            $rs = $htd->SaveToBin($rndFileName);
            if($rs)
            {
                $info = '';
                $imginfos = GetImageSize($rndFileName, $info);
                $fsize = filesize($rndFileName);
                //保存图片附件信息
                $inquery = "INSERT INTO `axcms_uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)
                VALUES ('{$arcID}','$rndFileName','$fileurl','1','{$imginfos[0]}','$imginfos[1]','0','$fsize','".time()."','".$cuserLogin->getUserID()."'); ";
                $dsql->ExecuteNoneQuery($inquery);
                $fid = $dsql->GetLastID();
                AddMyAddon($fid, $fileurl);
                if($cfg_multi_site == 'Y')
                {
                    $fileurl = $cfg_basehost.$fileurl;
                }
                $body = str_replace($value, $fileurl, $body);
                @WaterImg($rndFileName, 'down');
            }
        }
        $htd->Close();
        return $body;
    }

     

     
    标签: 织梦dede iframe
    打赏
     
    更多>同类资讯
    0相关评论

    推荐图文
    推荐资讯
    点击排行
    网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报
     
    展开
    国产亚洲视频免费播放 <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>