size = '320x320'; $this->siret = $siret; $c = Zend_Registry::get('config'); $this->path = realpath($c->profil->path->data).'/google/streetview'; } /** * * @param unknown $lattitude * @param unknown $longitude */ public function setLocationGeo($lattitude, $longitude) { $this->location = $lattitude.','.$longitude; } /** * * @param unknown $adresse */ public function setLocationTxt($adresse){} /** * * @param unknown $num */ public function setHeading($num) { $this->heading = $num; } /** * * @return multitype:number */ public function getNumDeg() { $mark = array(); $deg = 360/$this->nbImage; $i=$calc=0; while ($calc<360) { $mark[$i] = $calc; $calc+=$deg; $i++; } return $mark; } /** * * @return string */ public function urlImg() { $url = ''; $params = array( 'size', 'location', 'fov', 'pitch', 'sensor', 'heading' ); foreach ($params as $param) { if ( $this->{$param} !== null ) { $url.= '&'.$param.'='. $this->{$param}; } } return $this->url . substr($url,1); } /** * */ public function getImg() { require_once 'common/curl.php'; $page = getUrl($this->url, '', '', '', false); Zend_Registry::get('firebug')->info('URL = '.$this->url); if ( !in_array($page['code'], array(400, 408, 403)) ) { $body = $page['body']; file_put_contents($this->pathImg(), $body); } } /** * * @return string */ public function pathImg() { $filename = $this->siret.'-'.$this->heading . '.' . $this->extension; return $this->path . DIRECTORY_SEPARATOR . $filename; } /** * * @return string */ public function display() { $this->url = $this->urlImg(); $file = $this->pathImg(); Zend_Registry::get('firebug')->info('Filename = '.$file); if ( !file_exists($file) ) { $this->getImg(); } return basename($file); } }