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.

nufileget.php for nuBuilderForte

Questions related to using nuBuilder Forte.
Post Reply
pierrot
Posts: 15
Joined: Thu Dec 14, 2017 11:51 am

nufileget.php for nuBuilderForte

Unread post 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;
?>
admin
Site Admin
Posts: 2829
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: nufileget.php for nuBuilderForte

Unread post by admin »

pierott,

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

Steven
pierrot
Posts: 15
Joined: Thu Dec 14, 2017 11:51 am

Re: nufileget.php for nuBuilderForte

Unread post by pierrot »

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

Re: nufileget.php for nuBuilderForte

Unread post by admin »

perriot,

Exclude the hash.

I will change the wiki.

Get the latest from github

Steven
Post Reply