:::

11. 多媒體RSS

一、自動判別高度

1.主表格為id=tbl,左邊目錄為id=w1,右邊iframe為id=w2,工具列高120px
<script type='text/javascript'>
$(document).ready(function() {
  var wh=$(window).height();
  w1h = wh-120;
  w2h = wh-130;
  $('#tbl').height(wh);
  $('#w1').height(w1h);
  $('#w2').height(w2h);
});
</script>

二、Media RSS規格

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
    <item>
         <title>標題</title>
         <media:description> 相關描述</media:description>
         <link>連結</link>
         <media:thumbnail url="http://縮圖連結位置"/>
         <media:content url="http://原圖連結位置"/>
    </item>
</channel>
</rss>


三、套用Cooliris 3D Wall效果

1.加上連結:
<a href='cooliris.php?dir="._UPLOAD_DIR."' target='show'>此目錄下圖片的3D牆</a>


2.cooliris.php
<?php
echo "
<object id='o' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
  width='550' height='400'>
<param name='movie' value='http://apps.cooliris.com/embed/cooliris.swf' />
<param name='allowFullScreen' value='true' />
<param name='allowScriptAccess' value='always' />
<param name='flashvars' value='feed=http://localhost/11/mrss.php?dir={$_GET['dir']}' />
<embed type='application/x-shockwave-flash'
  src='http://apps.cooliris.com/embed/cooliris.swf'
  flashvars='feed=http://localhost/11/mrss.php?dir={$_GET['dir']}'
  width='550'
  height='400'
  allowFullScreen='true'
  allowScriptAccess='always'>
</embed>
</object>";
?>


3.crossdomain.xml(請直接放到網頁根目錄下即可)
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <allow-access-from domain="*.cooliris.com" secure="false" />
</cross-domain-policy>


4.mrss.php
<?php
$base_dir=(empty($_GET['dir']))?"D:/httpd/11/uploads":$_GET['dir'];
$data=get_pics($base_dir);

echo "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>
<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
    $data
</channel>
</rss>";

//取得圖片
function get_pics($dir){
    $base_dir="D:/httpd/11/uploads";
    $base_url="http://localhost/11/uploads";

    $data="";
    $files = glob($dir.'*', GLOB_MARK );
    foreach($files as $file){
        if(is_dir($file)){
            $data.=get_pics($file);
        }else{
            $file_name=str_replace($base_dir,"",$file);
            $file_url=str_replace($base_dir,$base_url,$file);
            $file_url=str_replace("\\","/",$file_url);

            $ext=substr(strtolower($file),-3);
            if(in_array($ext,array("jpg","gif","png","jpeg"))){
                $data.="<item>
                    <title>{$file_name}</title>
                    <link>{$file_url}</link>
                    <media:thumbnail url=\"{$file_url}\"/>
                    <media:content type=\"image/{$ext}\" url=\"{$file_url}\" />
                </item>
                ";
                }
            }
    }
    return $data;
}
?>

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Fmail.tad0616.cp22.secserverpros.com%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D274%26tbsn%3D9

書籍目錄

展開 | 闔起

線上使用者

320人線上 (132人在瀏覽線上書籍)

會員: 0

訪客: 320

更多…