Page 1 of 1

nufileget.php for nuBuilderForte

Posted: Fri Dec 22, 2017 3:21 pm
by pierrot
I've recreated nufileget.php script from nuBuilderPro.
Is there a better way to display images in HTML object with <img src='nufileget.php?i=CODE'> ?

Code: Select all

<?php.
$conf = dirname(__FILE__).'/nuconfig.php';
require($conf);

$code = $_GET['i'];
$sql = "SELECT sfi_json FROM zzzzsys_file WHERE sfi_code=:code";
$conStr = "mysql:host=$nuConfigDBHost;dbname=$nuConfigDBName;charset=utf8";
$this_db = new PDO($conStr, $nuConfigDBUser, $nuConfigDBPassword);
$this_db_obj = $this_db->prepare($sql);

$this_db_obj->execute(array(":code" => $code));
$this_db_obj->bindColumn(1, $data, PDO::PARAM_LOB);
$this_db_obj->fetch(PDO::FETCH_BOUND);

$obj = json_decode($data);
header("Content-Type:".$obj->{'type'});
$data = base64_decode($obj->{'file'});
$data = str_replace('data:'.$obj->{'type'}.';base64,', '', $data);
$data = base64_decode($data);
echo $data;
?>

Re: nufileget.php for nuBuilderForte

Posted: Fri Dec 22, 2017 9:57 pm
by admin
pierott,

You can use nuAttachImage()... http://wiki.nubuilder.net/nubuilderfort ... ttachImage

Steven

Re: nufileget.php for nuBuilderForte

Posted: Fri Dec 22, 2017 10:55 pm
by pierrot
Thanks.
Example from wiki works after I put # before html_object_id.

Code: Select all

nuAttachImage('#floor_plan', 'PLAN');
Marry Christmas

Re: nufileget.php for nuBuilderForte

Posted: Sat Dec 23, 2017 12:31 am
by admin
perriot,

Exclude the hash.

I will change the wiki.

Get the latest from github

Steven