Page 1 of 1
Adding a dynamic image
Posted: Sat Feb 27, 2016 8:25 am
by Karl
Hi,
I can display images located under profoundui http path (/www/profoundui/htdocs/) .
But how can I display images located somewhere in IFS (not within http path) or located
within smb path?
Karl
Re: Adding a dynamic image
Posted: Sat Feb 27, 2016 9:08 pm
by Scott Klement
Since browsers retrieve files using the HTTP protocol, the "normal" behavior is to only retrieve files that are available to Apache. By default, this means files in the DocumentRoot (by default, that is the "htdocs" directory that you mention.) You can enable other directories by creating Aliases for them in your httpd.conf configuration file.
Files placed in Aliases or the htdocs file are available to everyone with no security. For that reason, it might be a good idea to use the pui.downloadURL() API instead of an Alias. With this API, you can use the PUIDNLEXIT exit program to control access to the files. This approach lets you access files anywhere in the IFS (including /QNTC for SMB access) without any need for an Alias.
http://www.profoundlogic.com/docs/pages ... d=13664291
A third method would be to use an http:// URL to retrieve the images from another server. If your images are hosted on another server, retrieving them this way has shown itself to be more reliable than using /QNTC.
Re: Adding a dynamic image
Posted: Sun Feb 28, 2016 4:49 am
by Karl
Thank You - this is what I am looking for, but it seems I do not use this API correctly.
I've set the 'image source' property Custom JavaScript Function to:
script: pui.downloadURL({ "id": "/home/username/test.gif", "contentType": "image/gif" });
The result is an URL like this - but no Image is shown:
http://systemname:8090/profoundui/%5Bobject%20Object%5D
Re: Adding a dynamic image
Posted: Mon Feb 29, 2016 11:54 am
by Glenn
Karl,
Have you setup your PUIDNLEXIT program described in the documentation?
http://www.profoundlogic.com/docs/pages ... d=10092551
This program is used, as Scott mentioned, to allow your organization to control access to the requested resources.
Glenn
Re: Adding a dynamic image
Posted: Mon Feb 29, 2016 12:13 pm
by Karl
>Have you setup your PUIDNLEXIT program described in the documentation?
Yes - I have compiled PUIDNLEXIT without changes, to allow all downloads.
The usage counter of PUIDNLEXIT ist still zero.
Must it be called within my application or is it called from PUI?
Re: Adding a dynamic image
Posted: Mon Feb 29, 2016 12:22 pm
by Glenn
Karl,
The PUIDNLEXIT program is called by our runtime framework, you don't need to call it directly. Did you compile it into the same library that Profound UI is installed (default installation library is PROFOUNDUI)?
Also, does the image in fact exist in /home/username/test.gif?
Glenn
Re: Adding a dynamic image
Posted: Mon Feb 29, 2016 2:38 pm
by Karl
>Did you compile it into the same library that Profound UI is installed
Yes - installation library is profound89 - I have compiled PUIDNLEXIT into library profound89 and into profoundui.
>Also, does the image in fact exist in /home/username/test.gif?
Yes - I have built as simple program - only show one picture.
The IFS path with the image is not within /www/profound89 and not within /www/profoundui.
Maybe I miss something with image properties in designer.
I have set image properties field - image source - field formatting - custom java script function:
script: pui.downloadURL({ "id": "/home/KAPPEL/3.gif", "contentType": "image/gif" });
Maybe You can provide a working example with image path not within http path.
Re: Adding a dynamic image
Posted: Mon Feb 29, 2016 3:45 pm
by Glenn
Karl,
I think I may see the problem. You should put the text "script: pui.downloadURL({ "id": "/home/KAPPEL/3.gif", "contentType": "image/gif" });" directly into the 'image source' property not bound into the binding dialog.
I would do the following...
- right click on the 'image source' property and choose 'Remove Property Value'.
- remove property.png (14.59 KiB) Viewed 2588 times
- type the script text above directly into the window next to the 'image source' property.
- enter here.png (11.08 KiB) Viewed 2588 times
Try these steps and let me know if that works for you.
Glenn
Re: Adding a dynamic image
Posted: Tue Mar 01, 2016 8:36 am
by Karl
>Try these steps and let me know if that works for you.
Thank You - it works.