[Phphtmllib-devel] SF.net SVN: phphtmllib:[3434] trunk/open2300/lib/modules/wxdate/page/WxDate .inc
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-03-15 17:13:29
|
Revision: 3434 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3434&view=rev Author: hemna Date: 2010-03-15 17:13:01 +0000 (Mon, 15 Mar 2010) Log Message: ----------- added download link Modified Paths: -------------- trunk/open2300/lib/modules/wxdate/page/WxDate.inc Modified: trunk/open2300/lib/modules/wxdate/page/WxDate.inc =================================================================== --- trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-03-08 00:20:27 UTC (rev 3433) +++ trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-03-15 17:13:01 UTC (rev 3434) @@ -38,14 +38,25 @@ $filename = $config->get('videodir')."/".$curdate."/timelapse.flv"; //$cam_title_div->add($filename); if (file_exists($filename)) { - $url = '/video/player.swf?file=/video/'.$curdate.'/timelapse.flv&autostart=0'; + $flv_file = "/video/".$curdate."/timelapse.flv"; + $url = '/video/player.swf?file='.$flv_file.'&autostart=0'; $obj = new ObjectTag(array("data" => $url, "type" => "application/x-shockwave-flash", "quality" => "high", "wmode" => "transparent", "pluginspage" => "http://www.adobe.com/go/getflashplayer", "width" => "320", "height" => "240"), '<param name="movie" value="'.$url.'"><param name="allowFullScreen" value="true">'); + $rp = realpath($GLOBALS["path_base"]."/htdocs".$flv_file); + $fp = fopen($rp,"r"); + $str = "Download Movie"; + if ($fp) { + $fstat = fstat($fp); + $str .= " (".$this->byte_size($fstat["size"]).")"; + fclose($fp); + } + $div->add(BRtag::factory(2),$obj); + $div->add(BRtag::factory(2),new Atag(array("href" => $flv_file, "class" => "download"), $str)); } return $div; @@ -93,6 +104,23 @@ // $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:510px;'),$right_div)); // return $table; } + + function byte_size($bytes) { + $size = $bytes / 1024; + if ($size < 1024) { + $size = number_format($size, 2); + $size .= ' KB'; + } else { + if ($size / 1024 < 1024) { + $size = number_format($size / 1024, 2); + $size .= ' MB'; + } else if ($size / 1024 / 1024 < 1024) { + $size = number_format($size / 1024 / 1024, 2); + $size .= ' GB'; + } + } + return $size; + } public function get_cache_key() { return get_class($this).$this->wxdate; @@ -102,4 +130,4 @@ return 60; } } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |