Focal Point
[Solved] Display Embedded Thumbnails in 8202

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9457027986

March 23, 2018, 09:50 AM
Dan Brooke
[Solved] Display Embedded Thumbnails in 8202
Hi FP,

I'd like to create a report that displays the embedded thumbnail of selected reports/charts in 8202.

The image appears to be stored as a BLOB in WF_OBJPROPSEX. We use a Postgres DB for the repository so BLOBs are supported fine.

This help doc walks through how to display a BLOB in a fex: Display BLOB

Using that help doc, I wrote the following fex. The handle could be swapped to any handle in your repository to give it a try.

The output "almost" works but the image doesn't actually display in Chrome or FireFox. I get a reserved image space and a generic "your image didn't load" graphic. Has anyone gotten this to work? Does anyone see issues with my syntax?

Thanks for your help (in advance)!

 
-* Display BLOB image in HTML report
 TABLE FILE WF_OBJPROPSEX
PRINT PROPERTY PROPVALUE AS 'PICTURE'
BY PROPERTY 
BY OBJ_HANDLE
WHERE OBJ_HANDLE EQ 'aa55c4b9_bdb6_4c44_b335_1453a888e630';
ON TABLE SET PAGE NOPAGE
-**************************
-* Lines between asterisk lines required for BLOB image support 
-* for HTML and DHTML formats.
ON TABLE SET HTMLEMBEDIMG AUTO
-* Required to support IE8 with images larger than 32K
ON TABLE SET HTMLARCHIVE ON
-*Required for image positioning in subheads in HTML reports
ON TABLE SET HTMLCSS ON 
-**************************
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=REPORT,COLOR=BLUE,FONT=ARIAL, GRID=OFF,$
TYPE=HEADING, SIZE = 18, COLOR=RED,$
TYPE=DATA,COLUMN=PROPVALUE,IMAGE=(PROPVALUE),SIZE=(2 2),$
ENDSTYLE
END 

This message has been edited. Last edited by: Dan Brooke,


Dan B.
WebFocus 8205M
March 25, 2018, 04:05 PM
Waz
I wonder if you can hold the image (assuming its a gif or jpg), then use SET HTMLFORMTYPE = GIF|JPG and -HTMLFORM {holdname}

Or use EDAGET, do a search of the forum for some examples.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 26, 2018, 06:33 AM
Wep5622
What format are those images? I suspect they're not a web-format (GIF, PNG, JPEG), but rather something like BMP.

Alternatively, is the URL to the images correct? There are differences in how Internet Explorer resolves relative URI's and how standards compliant browsers do that.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
March 26, 2018, 08:11 AM
Tony A
Dan,

How about using developers tools in your browser to locate the image within the BIP and maybe use the URL used to render the image there?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 26, 2018, 08:39 AM
Frans
Here is a working example with CAR:

SET BASEURL=''
DEFINE FILE CAR
IMG/A500='data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==';
END
TABLE FILE CAR
PRINT COUNTRY
IMG
ON TABLE SET PAGE NOPAGE
ON TABLE SET HTMLEMBEDIMG OFF
ON TABLE SET HTMLARCHIVE OFF
ON TABLE SET HTMLCSS ON


ON TABLE PCHOLD FORMAT HTML

ON TABLE SET STYLE *
TYPE=REPORT,COLOR=BLUE,FONT=ARIAL, GRID=OFF,$
TYPE=HEADING, SIZE = 18, COLOR=RED,$
TYPE=DATA,COLUMN=IMG,IMAGE=(IMG),$
ENDSTYLE
END

Check what is in your BLOB (base64 encoded?)


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
March 26, 2018, 08:54 AM
Francis Mariani
FocalPointers, the original post mentions
quote:
the image doesn't actually display in Chrome or FireFox
Does this mean it worked in another web browser, Internet Explorer, for example?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 26, 2018, 08:58 AM
Francis Mariani
I tried Frans's example and it displays a red dot in Internet Explorer and a place-holder icon in Chrome.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 26, 2018, 09:09 AM
Frans
Hmm I see, apparantly webFOCUS makes a .gif suffix to the text, which is not accepted by Chrome. If you remove the .gif with developer tools you see a red dot in Chrome.

Would be worth opening a case for this.


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
March 26, 2018, 10:27 AM
Tony A
Dan,

There are components in several tables (or so it appears) that you need to bring together to take advantage of the method used to display the images within the BIP ([server][port]/ibi_apps/).

The URL that is used is of the form "/ibi_apps/wfirs/ibfs/[path to object]?IBFS_action=getAssocImage&IBFS_epoc=[longnumber]"

It appears that you can obtain the necessary components as below in some sample code. It might require some refinement but it appears to give results.

JOIN CLEAR *
JOIN HANDLE        IN WF_REPOSOBJ TAG T0 TO MULTIPLE OBJ_HANDLE IN WF_OBJPROPS TAG T1 AS J1
JOIN T1.OBJ_HANDLE IN WF_REPOSOBJ        TO MULTIPLE OBJ_HANDLE IN WF_OBJPROPS TAG T2 AS J2

TABLE FILE WF_REPOSOBJ
   SUM COMPUTE IMG/A500 = '<img src="/ibi_apps/wfirs/ibfs'||T0.PRT_PATH||'/'||T0.OBJNAME||'?IBFS_action=getAssocImage&|IBFS_epoc='||T1.PROPVALUE||'" />'; AS ''
    BY T0.OBJNAME AS ''
WHERE T0.CLASSNAME EQ 'WfItem'
WHERE T1.PROPERTY IN ('ThumbnailDateTime'); -* provides the epoc value
WHERE T2.PROPERTY IN ('ThumbnailType'); -* limits the output to correct object type
-*WHERE HANDLE EQ '0011c317_552d_4195_863f_bf030f661ad2';
ON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
TYPE=REPORT,COLOR=BLUE,FONT=ARIAL, GRID=OFF,$
ENDSTYLE
END


T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 26, 2018, 02:44 PM
Dan Brooke
Tony A, your solution worked! This is a very elegant approach considering you use IBI's built in BLOB-rendering functions (instead of trying to do it in the fex) and also no need to join to the WF_OBJPROPSEX table.

To answer others and in case it helps the next person, the image I used were:
-png/jpg
-base64 encoded BLOB file

Thank you all for the help!

I'll update the thread subject to "solved"


Dan B.
WebFocus 8205M
March 26, 2018, 03:06 PM
Tony A
Good to know it helped Dan. Sometimes an indirect method sorts the day.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10