Exemple #1
0
function handleRequest()
{
    if (isset($_POST['studio'])) {
        Camera::saveCameras($_POST);
    } else {
        if (isset($_GET['camera'])) {
            echo json_encode(Camera::getCameras());
        } else {
            if (isset($_GET['changeField'])) {
                $fieldName = $_GET['field'];
                $restId = $_GET['restId'];
                $value = $_GET['value'];
                updateUsersInRestField($restId, $fieldName, $value);
            } else {
                if (validRequestParams()) {
                    $userEmail = $_GET['userId'];
                    $restId = $_GET['rest'];
                    $restName = $_GET['restName'];
                    $restImage = $_GET['restImage'];
                    if ($restId !== '' && userExistInWix($userEmail)) {
                        setRestaurantDetails($restId, $restImage, $restName);
                        insertUserToRest($userEmail, $restId);
                    }
                    returnDataToExtension($userEmail, $restId, $restName);
                } else {
                    echo 'Invalid request, restaurant id, name or user email is missing';
                }
            }
        }
    }
}
Exemple #2
0
<?php

/* ************************************************************************** */
/*                                                                            */
/*                 main_04.php for J06                                        */
/*                 Created on : Mon Mar 31 17:37:41 2014                      */
/*                 Made by : David "Thor" GIRON <*****@*****.**>                  */
/*                                                                            */
/* ************************************************************************** */
require_once 'Vertex.class.php';
require_once 'Vector.class.php';
require_once 'Matrix.class.php';
require_once 'Camera.class.php';
Vertex::$verbose = False;
Vector::$verbose = False;
Matrix::$verbose = False;
print Camera::doc();
Camera::$verbose = True;
$vtxO = new Vertex(array('x' => 20.0, 'y' => 20.0, 'z' => 80.0));
$R = new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI));
$cam = new Camera(array('origin' => $vtxO, 'orientation' => $R, 'width' => 640, 'height' => 480, 'fov' => 60, 'near' => 1.0, 'far' => 100.0));
print $cam . PHP_EOL;
function ipcam_plugin_setting_page()
{
    global $_, $myUser, $conf;
    if (isset($_['section']) && $_['section'] == 'ipcam') {
        require_once 'Camera.class.php';
        if (!$myUser) {
            throw new Exception('Vous devez être connecté pour effectuer cette action');
        }
        $cameraManager = new Camera();
        $cameras = $cameraManager->populate();
        $roomManager = new Room();
        $rooms = $roomManager->populate();
        $selected = new Camera();
        //Si on est en mode modification
        if (isset($_['id'])) {
            $selected = $cameraManager->getById($_['id']);
        }
        ?>

		<div class="span9 userBloc">

			<h1>Camera</h1>
			<p>Gestion des cameras IP</p>  

			<fieldset>
			    <legend>Ajouter/Modifier une camera</legend>

			    <div class="left">

				    <label for="labelCamera">Nom</label>
				    <input type="hidden" id="id" value="<?php 
        echo $selected->id;
        ?>
">
				    <input type="text" id="labelCamera" value="<?php 
        echo $selected->label;
        ?>
" placeholder="Sonde du salon"/>
			
				    <label for="ipCamera">IP</label>
				    <input type="text" value="<?php 
        echo $selected->ip;
        ?>
" id="ipCamera" placeholder="192.168.11.27:87" />
				    
					<label for="loginCamera">Login</label>
				    <input type="text" value="<?php 
        echo $selected->login;
        ?>
" id="loginCamera" placeholder="" />
				    
				    <label for="passwordCamera">Password</label>
				    <input type="text" value="<?php 
        echo $selected->password;
        ?>
" id="passwordCamera" placeholder="" />
				    
				    <label for="locationCamera">Pièce de la maison</label>
				    <select id="locationCamera">
				    	<?php 
        foreach ($rooms as $room) {
            ?>
				    	<option <?php 
            if ($selected->location == $room->getId()) {
                echo "selected";
            }
            ?>
 value="<?php 
            echo $room->getId();
            ?>
"><?php 
            echo $room->getName();
            ?>
</option>
				    	<?php 
        }
        ?>
				    </select>
				   
				</div>

	  			<div class="clear"></div>
			    <br/><button onclick="plugin_ipcam_save(this)" class="btn">Enregistrer</button>
		  	</fieldset>
			<br/>


			<fieldset>
				<legend>Consulter les sondes existants</legend>
				<table class="table table-striped table-bordered table-hover">
				    <thead>
					    <tr>
					    	<th>Nom</th>
						    <th>IP</th>
						    <th>Pièce</th>
						    <th colspan="2"></th>
						    
					    </tr>
				    </thead>
			    
			    	<?php 
        foreach ($cameras as $camera) {
            $room = $roomManager->load(array('id' => $camera->location));
            ?>
					<tr>
				    	<td><?php 
            echo $camera->label;
            ?>
</td>
					    <td><?php 
            echo $camera->ip;
            ?>
</td>
					    <td><?php 
            echo $room->getName();
            ?>
</td>
					    <td>
					    	<a class="btn" href="setting.php?section=ipcam&id=<?php 
            echo $camera->id;
            ?>
"><i class="fa fa-pencil"></i></a>
					    	<div class="btn" onclick="plugin_ipcam_delete(<?php 
            echo $camera->id;
            ?>
,this);"><i class="fa fa-times"></i></div>
					    </td>
					    </td>
			    	</tr>
			    <?php 
        }
        ?>
			    </table>
			</fieldset>
		</div>

<?php 
    }
}
Exemple #4
0
    $hl = $l / 2.0;
    $a = new Vertex(array('x' => $x - $hl, 'y' => $y + $hl, 'z' => $z + $hl, 'color' => $red));
    $b = new Vertex(array('x' => $x + $hl, 'y' => $y + $hl, 'z' => $z + $hl, 'color' => $green));
    $c = new Vertex(array('x' => $x + $hl, 'y' => $y + $hl, 'z' => $z - $hl, 'color' => $blue));
    $d = new Vertex(array('x' => $x - $hl, 'y' => $y + $hl, 'z' => $z - $hl, 'color' => $yellow));
    $e = new Vertex(array('x' => $x - $hl, 'y' => $y - $hl, 'z' => $z + $hl, 'color' => $magenta));
    $f = new Vertex(array('x' => $x + $hl, 'y' => $y - $hl, 'z' => $z + $hl, 'color' => $cyan));
    $g = new Vertex(array('x' => $x + $hl, 'y' => $y - $hl, 'z' => $z - $hl, 'color' => $grey));
    $h = new Vertex(array('x' => $x - $hl, 'y' => $y - $hl, 'z' => $z - $hl, 'color' => $white));
    return array(new Triangle($a, $c, $b), new Triangle($a, $d, $c), new Triangle($e, $g, $h), new Triangle($e, $f, $g), new Triangle($e, $b, $f), new Triangle($a, $b, $e), new Triangle($d, $g, $c), new Triangle($d, $h, $g), new Triangle($a, $e, $h), new Triangle($a, $h, $d), new Triangle($f, $c, $g), new Triangle($f, $b, $c));
}
$v = new Vector(array('dest' => new Vertex(array('x' => 20.0, 'y' => 20.0, 'z' => 0.0))));
$T = new Matrix(array('preset' => Matrix::TRANSLATION, 'vtc' => $v));
$S = new Matrix(array('preset' => Matrix::SCALE, 'scale' => 10.0));
$RY = new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI_4));
$RX = new Matrix(array('preset' => Matrix::RX, 'angle' => M_PI_4));
$cam = new Camera(array('origin' => new Vertex(array('x' => 15.0, 'y' => 15.0, 'z' => 80.0)), 'orientation' => new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI)), 'width' => 640, 'height' => 480, 'fov' => 60, 'near' => 1.0, 'far' => 100.0));
$renderer = new Render(640, 480, 'pic.png');
$origin = new Vertex(array('x' => 0.0, 'y' => 0.0, 'z' => 0.0));
$origin = $cam->watchVertex($origin);
$repere = makeRepere();
$repere = $S->transformMesh($repere);
$repere = $cam->watchMesh($repere);
$renderer->renderMesh($repere, Render::EDGE);
$renderer->renderVertex($origin);
$cube = makeColoredCube(0.0, 0.0, 0.0, 1.0);
$M = $T->mult($RX)->mult($RY)->mult($S);
$cube = $M->transformMesh($cube);
$cube = $cam->watchMesh($cube);
$renderer->renderMesh($cube, Render::RASTERIZE);
$renderer->develop();
Exemple #5
0
$split_size = explode('-', $size);
$width = $split_size[0];
$height = $split_size[1];
$settings_file = str_replace('ajax/' . basename(__FILE__), 'data/settings.json', __FILE__);
$settings = array();
$settings['encoding'] = $encoding;
$settings['iso'] = $iso;
$settings['width'] = $width;
$settings['height'] = $height;
$settings['quality'] = $quality;
$settings['imxfx'] = $imxfx;
$settings['brightness'] = $brightness;
$settings['contrast'] = $contrast;
$settings['sharpness'] = $sharpness;
$settings['saturation'] = $saturation;
$settings['awb'] = $awb;
$settings['ev'] = $ev_comp;
$settings['exposure'] = $exposure;
$settings['rotation'] = $rotation;
$settings['metering'] = $metering;
$settings['flip'] = $flip;
$settings['name'] = 'picture';
$json = json_encode($settings);
write_file($settings_file, $json, 'w');
$camera = new Camera($settings);
$camera->output->setValue(TEMP_PATH . 'picture.' . $settings['encoding']);
$camera->{$flip}->setValue(' ');
$camera->doImage();
$_response_items['command'] = $camera->get_command();
header('Content-Type: application/json');
echo json_encode($_response_items);
Exemple #6
0
<?php

$settings_file = str_replace('media/' . basename(__FILE__), 'data/settings.json', __FILE__);
$settings = json_decode(file_get_contents($settings_file), true);
if (!file_exists('/var/www/temp/' . $settings['name'] . '.' . $settings['encoding'])) {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/pi_camera/Camera.php';
    $camera = new Camera($settings);
    $camera->output->setValue('/var/www/temp/' . $settings['name'] . '.' . $settings['encoding']);
    $camera->create();
}
$_image = '/var/www/temp/' . $settings['name'] . '.' . $settings['encoding'];
$_file_name = 'raspicam.' . $settings['encoding'];
$_data = file_get_contents($_image);
// Generate the server headers
if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== FALSE) {
    header('Content-Disposition: attachment; filename="' . $_file_name . '"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header("Content-Transfer-Encoding: binary");
    header('Pragma: public');
    header("Content-Length: " . strlen($_data));
} else {
    header('Content-Disposition: attachment; filename="' . $_file_name . '"');
    header("Content-Transfer-Encoding: binary");
    header('Expires: 0');
    header('Pragma: no-cache');
    header("Content-Length: " . strlen($_data));
}
exit($_data);
Exemple #7
0
 /**
  * @covers Pachico\Voyeur\Camera::get_hub_path
  */
 public function testGet_hub_path()
 {
     $this->assertSame(static::HUB_URI, $this->_camera->get_hub_path());
 }
Exemple #8
0
function clickme()
{
    $image = Camera::TakePhoto();
}
Exemple #9
0
 public function testViewMatrixValues()
 {
     $expectedView = 'mat4x4((1.000000, 0.000000, -0.000000, 0.000000), (0.000000, 1.000000, 0.000000, 0.000000), (0.000000, 0.000000, 1.000000, 0.000000), (0.000000, 0.000000, 0.000000, 1.000000))';
     $camera = new Camera();
     $this->assertEquals($expectedView, $camera->getViewMatrix()->__toString());
 }
Exemple #10
0
    $a = new Vertex(array('x' => $x - $hl, 'y' => $y + $hl, 'z' => $z + $hl, 'color' => $red));
    $b = new Vertex(array('x' => $x + $hl, 'y' => $y + $hl, 'z' => $z + $hl, 'color' => $green));
    $c = new Vertex(array('x' => $x + $hl, 'y' => $y + $hl, 'z' => $z - $hl, 'color' => $blue));
    $d = new Vertex(array('x' => $x - $hl, 'y' => $y + $hl, 'z' => $z - $hl, 'color' => $yellow));
    $e = new Vertex(array('x' => $x - $hl, 'y' => $y - $hl, 'z' => $z + $hl, 'color' => $magenta));
    $f = new Vertex(array('x' => $x + $hl, 'y' => $y - $hl, 'z' => $z + $hl, 'color' => $cyan));
    $g = new Vertex(array('x' => $x + $hl, 'y' => $y - $hl, 'z' => $z - $hl, 'color' => $grey));
    $h = new Vertex(array('x' => $x - $hl, 'y' => $y - $hl, 'z' => $z - $hl, 'color' => $white));
    return array(new Triangle($a, $c, $b), new Triangle($a, $d, $c), new Triangle($e, $g, $h), new Triangle($e, $f, $g), new Triangle($e, $b, $f), new Triangle($a, $b, $e), new Triangle($d, $g, $c), new Triangle($d, $h, $g), new Triangle($a, $e, $h), new Triangle($a, $h, $d), new Triangle($f, $c, $g), new Triangle($f, $b, $c));
}
$v = new Vector(array('dest' => new Vertex(array('x' => 20.0, 'y' => 20.0, 'z' => 0.0))));
$T = new Matrix(array('preset' => Matrix::TRANSLATION, 'vtc' => $v));
$S = new Matrix(array('preset' => Matrix::SCALE, 'scale' => 10.0));
$RY = new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI_4));
$RX = new Matrix(array('preset' => Matrix::RX, 'angle' => M_PI_4));
$cam = new Camera(array('origin' => new Vertex(array('x' => 15.0, 'y' => 15.0, 'z' => 80.0)), 'orientation' => new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI)), 'width' => 640, 'height' => 480, 'fov' => 60, 'near' => 1.0, 'far' => 100.0));
$renderer = new Render(array('width' => 640, 'height' => 480, 'filename' => 'pic.png'));
echo "test";
$origin = new Vertex(array('x' => 50.0, 'y' => 50.0, 'z' => 50.0));
$origin = $cam->watchVertex($origin);
$vtx = new Vertex(array('x' => 20.0, 'y' => 20.0, 'z' => 0.0));
$vtc = new Vertex(array('x' => -20.0, 'y' => -20.0, 'z' => 0.0));
$renderer->renderSegment($vtx, $origin);
$vtt = new Vertex(array('x' => 30.0, 'y' => 60.0, 'z' => 20.0));
$renderer->renderSegment($vtt, $vtx);
$renderer->renderSegment($vtt, $origin);
/*
$repere = makeRepere();

$repere = $S->transformMesh( $repere );
$repere = $cam->watchMesh( $repere );