Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Questions related to using nuBuilder Forte.
pierrot
Posts: 15 Joined: Thu Dec 14, 2017 11:51 am
Unread post
by pierrot » Fri Dec 22, 2017 3:21 pm
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;
?>
pierrot
Posts: 15 Joined: Thu Dec 14, 2017 11:51 am
Unread post
by pierrot » Fri Dec 22, 2017 10:55 pm
Thanks.
Example from wiki works after I put # before html_object_id.
Code: Select all
nuAttachImage('#floor_plan', 'PLAN');
Marry Christmas
admin
Site Admin
Posts: 2829 Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times
Unread post
by admin » Sat Dec 23, 2017 12:31 am
perriot,
Exclude the hash.
I will change the wiki.
Get the latest from github
Steven