Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions php/classes/Floorplanner/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,31 @@ public function embedScript($div, $token = null, $state = null) {
$javascript .= "fp.embed('${div}');\n";
return $javascript;
}

/**
* resolution[width] - The width of the image(s) in pixels (or millimeters for PDF)
* resolution[height] - The height of the image(s) in pixels (or millimeters for PDF)

Optional:
* send_to - result will be sent to given email address
* callback - After all design images have been exported, the callback URL will receive a POST request containing XML result message
* type - MIME type of requested export format
* paper_scale - Number between 0.002 and 0.02 (PDF only, see design export)
* scaling - if set to 'constant', all designs will be scaled by the same ratio
* scalebar - set to 1 or “true” to include a scale bar in the output image
* black_white - Boolean value (true/false) of whether the output should be in grayscale
*/
public function render($width, $height, $send_to="nobody@example.com") {
$response = $this->apiCall($this->path() . '/render', 'POST',
array('resolution' => array('width'=>$width, 'height'=>$height),
'send_to' => $send_to)
);
if (Floorplanner::success($response)) {
var_dump($response);
} else {
throw new Floorplanner_Exception($response);
}
}

}

Expand Down
6 changes: 6 additions & 0 deletions php/render_test/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

// Add your API key here
$config['api_key'] = '';

?>
14 changes: 14 additions & 0 deletions php/render_test/render.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

require '../classes/Floorplanner.php';
require 'config.php';

$fp = Floorplanner::connect($config['api_key']);

$project_id = $argv[1];

$project = $fp->getProject($project_id);

$renderResponse = $project->render(400, 600);

var_dump($renderResponse);
12 changes: 12 additions & 0 deletions php/render_test/upload_fml.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

require '../classes/Floorplanner.php';
require 'config.php';

$fp = Floorplanner::connect($config['api_key']);

$xml_file_path = $argv[1];
$xml = file_get_contents($xml_file_path);

$project = $fp->createProject($xml);
var_dump($project);