首页 php教程 PHP源码 读取图片地址

读取图片地址

May 25, 2016 pm 05:08 PM

代码

<?php
function litimgurls($imgid=0)
{
    global $lit_imglist,$dsql;
    //获取附加表
    $row = $dsql->GetOne("SELECT c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c 
                                                            ON a.channel=c.id where a.id=&#39;$imgid&#39;");
    $addtable = trim($row[&#39;addtable&#39;]);
    
    //获取图片附加表imgurls字段内容进行处理
    $row = $dsql->GetOne("Select imgurls From `$addtable` where aid=&#39;$imgid&#39;");
    
    //调用inc_channel_unit.php中ChannelUnit类
    $ChannelUnit = new ChannelUnit(2,$imgid);
    
    //调用ChannelUnit类中GetlitImgLinks方法处理缩略图
    $lit_imglist = $ChannelUnit->GetlitImgLinks($row[&#39;imgurls&#39;]);
    
    //返回结果
    return $lit_imglist;
}

/****************  
  function GetOneImgUrl  
  @@ 功能:读取自定义字段图片地址  
*****************/  
  
function GetOneImgUrl($img,$ftype=1){   
    echo $img;
    if($img <> &#39;&#39;){   
        $dtp = new DedeTagParse();   
        $dtp->LoadSource($img);   
        if(is_array($dtp->CTags)){   
            foreach($dtp->CTags as $ctag){   
                if($ctag->GetName()==&#39;img&#39;){   
                    $width = $ctag->GetAtt(&#39;width&#39;);   
                    $height = $ctag->GetAtt(&#39;height&#39;);   
                    $imgurl = trim($ctag->GetInnerText());   
                    $img = &#39;&#39;;   
                    if($imgurl != &#39;&#39;){   
                        if($ftype==1){   
                            $img .= $imgurl;   
                        }   
                        else{   
                            $img .= &#39;<img src="&#39;.$imgurl.&#39;" width="&#39;.$width.&#39;" height="&#39;.$height.&#39;" />&#39;;   
                        }   
                    }   
                               
                }   
            }   
        }   
        $dtp->Clear();   
        return $img;       
    }   
}  


/*根据文章id 返回文章arcurl
        *$ID 文章id
        */
        function getArcurlByArcid($ID)  
        {  
            global $dsql;  
            $query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath from dede_archives arc left join dede_arctype tp on arc.typeid=tp.id where arc.id = ".$ID;  
            $row = $dsql->GetOne($query);  
            $ReturnURL = GetFileUrl($row[&#39;id&#39;],$row[&#39;typeid&#39;],$row[&#39;senddate&#39;],$row[&#39;title&#39;],$row[&#39;ismake&#39;],  
            $row[&#39;arcrank&#39;],$row[&#39;namerule&#39;],$row[&#39;typedir&#39;],$row[&#39;money&#39;],$row[&#39;filename&#39;],$row[&#39;moresite&#39;],$row[&#39;siteurl&#39;],$row[&#39;sitepath&#39;]);  
            return $ReturnURL;  
        }
登录后复制
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)