Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marcus Brasizza  >  PHP Google Driving Directions  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Test script
Class: PHP Google Driving Directions
Get driving directions using Google Maps API
Author: By
Last change:
Date: 1 year ago
Size: 1,082 bytes
 

Contents

Class file image Download
<?php
include('googleApiClass.php');
$google = new googleApiClass();

$google->setFromAddress('England');
$google->setToAddress('France');
$google->setLanguage('us');
$google->setImageOutput('png');
$google->setZoom(14);
$google->setScale('1');
try{    
    
$pathImg '/tmp/mapMe.png';
    
$google->findAddress()->withImage(5,$pathImg);
    
    echo 
"From: "$google->getFromAddress().'<br>';
    echo 
"To: "$google->getToAddress().'<br>';
    echo 
"Distance: ".($google->getDistance()).' meters<br>';
    echo 
"Time: ".($google->getTime()).' seconds<br>';
    echo 
{$google->getCountSteps()} steps between from and to address<br>";
    echo 
"<hr><strong>Steps</strong>";
    echo 
"<pre>";
    
print_r($google->getInstructions());
    echo 
"</pre>";
    if(!
$google->getImgBuffer()){
        echo 
"No image was requested";
    }else{
        echo 
"Followed Image <br>";
        echo 
"Scale: ".$google->getScale().'<br>';
        echo 
"Center: ".$google->getCenterStep().'<br>';
        echo 
"Zoom: ".$google->getZoom().'<br>';
        
        echo 
"<img src='showimage.php?path={$pathImg}'><br>";
                
    }
    
    
}catch(
Exception $e ){
 echo 
$e->getMessage();
}

?>