コード例 #1
0
ファイル: Timelapse.php プロジェクト: BobbyBrights/social
    function show()
    {
        if ($this->name == "") {
            die("No name provided. <a href=/>Return to Home</a>");
        }
        $data = MySQLAdmin::read("select * from timelapse where name='" . $this->name . "' limit 1", 1);
        if ($data == false) {
            return false;
        }
        $this->data = $data;
        $str = "";
        /* public members */
        //$selectedtype = @$_GET['type'];
        $this->settings['frames'] = 0;
        $this->settings['speed'] = 0;
        $this->settings['date'] = 0;
        if (strlen($_REQUEST['permalinks'][2])) {
            $p = explode(",", $_REQUEST['permalinks'][2]);
            foreach ($p as $params) {
                $row = explode(":", $params);
                switch (strtolower($row[0])) {
                    case "frames":
                        $this->settings['frames'] = (int) $row[1];
                        break;
                    case "speed":
                        $this->settings['speed'] = (int) $row[1];
                        break;
                    case "date":
                        $this->settings['date'] = $row[1];
                        break;
                    case "navi":
                        $this->settings['navi'] = (int) $row[1];
                        break;
                    case "play":
                        $this->settings['play'] = $row[1];
                        break;
                    case "x":
                        $this->settings['x'] = (int) $row[1];
                        break;
                    case "y":
                        $this->settings['y'] = (int) $row[1];
                        break;
                    case "w":
                        $this->settings['w'] = (int) $row[1];
                        break;
                    case "h":
                        $this->settings['h'] = (int) $row[1];
                        break;
                }
            }
        }
        $this->range = $this->settings['frames'] ? $this->settings['frames'] : $this->defaultframes;
        $this->viewspeed = $this->settings['speed'] ? $this->settings['speed'] : $this->defaultspeed;
        $this->viewdate = $this->settings['date'] ? $this->settings['date'] : '';
        $custompan = $this->settings['w'] && $this->settings['h'];
        /* private members */
        $this->dirpath = "./data/{$this->name}/files/";
        if (!is_dir($this->dirpath)) {
            die("No se encontraron registros para esta linea de tiempo.");
        }
        //
        $filez = Utils::dirList($this->dirpath);
        $files = $filez[1];
        rsort($files);
        $this->filestotal = count($files);
        $this->startdate = $files[0][0];
        $this->enddate = $files[$this->filestotal - 1][0];
        $temp = array();
        if ($this->range > count($files)) {
            $this->range = count($files);
        }
        if ($this->settings['date'] != "") {
            sort($files);
            $dt = ts2date($this->settings['date']);
            for ($i = 0; $i < count($files); $i++) {
                $fn = @explode(".", $files[$i][0]);
                $ts = $fn[0];
                if ($ts) {
                    $dtc = ts2date($ts);
                    if ($dtc > $dt) {
                        if ($this->range > count($temp)) {
                            $temp[] = $files[$i];
                        }
                    }
                }
            }
            rsort($temp);
            $this->settings['historic'] = true;
        } else {
            //rsort($files);
            for ($i = 0; $i < $this->range; $i++) {
                $temp[] = $files[$i];
            }
        }
        $this->files = $temp;
        $imagesize = getimagesize($this->dirpath . '/' . $files[0][0]);
        $this->dw = $custompan ? $this->settings['w'] ? $this->settings['w'] : $this->dsize : $imagesize[0];
        $this->dh = $custompan ? $this->settings['h'] ? $this->settings['h'] : $this->dsize : $imagesize[1];
        if (is_numeric($this->settings['w']) && is_numeric($this->settings['h'])) {
            $resimage = array($this->settings['w'], $this->settings['h']);
        } else {
            $resimage = $imagesize;
        }
        if ($resimage) {
            $this->setSize($resimage[0], $resimage[1]);
        } else {
            $this->setSize(480, 340);
        }
        $this->imagesize = $imagesize;
        $str .= $this->printHeader();
        if ($this->settings['navi'] == 1) {
            $str .= '<span class="legend">
	<strong>w,h,x,y</strong> : <i>int (px)</i> &nbsp;&nbsp;
	<strong>frames</strong> : <i>int</i> &nbsp;&nbsp;
	<strong>date</strong> : <i>ymdHi (' . date('ymdHi') . ')</i> &nbsp;&nbsp;
	<strong>speed</strong> : <i>int (millisec)</i> &nbsp;&nbsp;
	<strong>navi</strong> : <i>bool</i> &nbsp;&nbsp;
	<strong>play</strong> : <i>bool</i>
	</span>
			<div class="panel-map-latest"><div class="panel-map-overlay"><div class="panel-map-rect"><div class="panel-map-legend"><span>' . $imagesize[0] . 'x' . $imagesize[1] . '</span></div></div></div></div>	
		
		';
        }
        if ($this->files) {
            $str .= $this->printFiles();
        }
        $str .= '
	
		</body>
		</html>
		
		';
        return $str;
    }
コード例 #2
0
ファイル: Screen.php プロジェクト: BobbyBrights/social
    function get_mapo_timelapse()
    {
        $name = $_REQUEST['permalinks'][1];
        if ($name == '') {
            return false;
        }
        $data = MySQLAdmin::get_timelapse($name);
        $imgpath = "./data/{$name}/files/";
        if (!is_dir($imgpath)) {
            die('<div class="messagebox">No se encontraron registros para el timelapse <strong>' . $name . '</strong>.</div>');
        }
        $files = Utils::fileList($imgpath);
        sort($files);
        rsort($files);
        array_splice($files, 5);
        sort($files);
        $filestotal = count($files);
        $limit = $filestotal > 5 ? 5 : $filestotal;
        $temp = array();
        for ($i = 0; $i < $limit; $i++) {
            $mins = (time() - filename2date($files[$i], 'U')) / 60;
            $unixtime = filename2date($files[$i], $mins > 1440 ? 'Y M j D H:i' : 'D H:i');
            $timestamp = "" . date2es($unixtime) . ' (hace ' . timespan($mins) . ')';
            $temp[] = array($files[$i], $timestamp);
        }
        ?>

		<div id="clicmap" style="position:absolute;top:0;left:0;background:transparent url(<?php 
        echo WWWPATH;
        ?>
/static/resize/?t=<?php 
        echo implode("/", array('data', $name, 'overlay.png'));
        ?>
&w=1020&h=500) no-repeat;width:1020px;height:500px; display:block;z-index:101;cursor:pointer;"></div>

	  <div id='slideshow'>
	
	    <div id="ss_image"> 
	
			<?php 
        $i = 0;
        foreach ($temp as $row) {
            $i++;
            ?>
			
				<div class="slide<?php 
            echo $i > 1 ? ' no-js' : '';
            ?>
"><span><?php 
            echo $row[1];
            ?>
</span>
					<a href="#<?php 
            echo $i;
            ?>
">
						<img src="<?php 
            echo WWWPATH;
            ?>
/static/resize/?t=<?php 
            echo implode("/", array('data', $name, 'files', $row[0]));
            ?>
&w=1020&h=500" width="1020" height="500" />
					</a>
				</div>
	
			<?php 
        }
        ?>
	
			
	 		</div> 
	    <div id="ss_controls" class="no-js">
	    </div> 
	  </div> 
		
		<?php 
    }