Adding an Image to a Report
With a StyleSheet you can add and position an image in a report. An image, such as a logo, gives corporate identity to a report, or provides visual appeal. You can add more than one image by creating multiple declarations. StyleSheets and adding graphics" />
You can also add an image as background to a report. A background image is tiled or repeated, covering the entire area on which the report displays. An image attached to an entire report, or an image in a heading or footing, can appear with a background image.
Images must exist in a file format your browser supports, such as GIF (Graphic Interchange Format) or JPEG (Joint Photographic Experts Group, .jpg extension).
Image support with WebFOCUS standard reporting formats
- GIF and JPG images are supported in DHTML, HTML, PDF, PS, PPTX, XLSX, and PPT standard report formats. JPEG images are only supported with HTML standard report format. For other report formats, you can change the extension of the image name from .jpeg to .jpg, and the image will be displayed in the report output.
- PNG images are supported with DHTML, HTML, PPTX, and PDF standard report formats, while WebFOCUS generated SVG charts will display when inserted in HTML, PDF, and PS report formats.
- SVG images are supported only with HTML reports.
- Center and right justification of images in PDF reports is only reflected if the JUSTIFY=CENTER or JUSTIFY=RIGHT StyleSheet attribute is explicitly set on the image declaration attribute. By default, if JUSTIFY is not specified in the image declaration attribute, the image is left justified.
- Images are not supported in EXL2K standard report format.
Image support in Compound Report syntax
- GIF and JPG images are supported in DHTML, PDF, PPTX, and PPT Compound document syntax. JPEG images are not supported with any reporting format, but the images will work in these compound formats if the extension is changed from .jpeg to .jpg.
- PNG images are supported with DHTML, PPT, PPTX, and PDF Compound documents.
- SVG images are not supported with any WebFOCUS reporting format in Compound documents, while WebFOCUS generated SVG charts are supported only with PDF Compound documents.
- Images are not supported in EXL2K Compound documents.
For PDF, HTML, and DHTML output against data sources that support the Binary Large Object (BLOB) data type (Microsoft SQL Server, DB2, Oracle, Informix, and PostgreSQL, using its BYTEA data type), an image can be stored in a BLOB field in the data source.
The image must reside on the WebFOCUS Reporting Server in a directory named on EDAPATH or APPPATH. If the file is not on the search path, supply the full path name.
Browser and Device Support for Images in HTML Documents
Support for presenting images and graphs in HTML and DHTML formatted standard reports and compound documents is provided using an image embedding facility that allows 64-bit images to be encoded within a generated .htm file.
The SET HTMLEMBEDIMG command is designed to ensure that all WebFOCUS reports containing images can be accessed from any browser or device. By default, it is set to ON and embeds images within an .htm file.
SET HTMLEMBEDIMG={ON|OFF|AUTO}
where:
Encodes images within the .htm file. ON is the default value, and overrides the HTMLARCHIVE settings.
Does not embed the image. If HTMLARCHIVE is set to ON, .mht files are generated.
Determines which encoding algorithm to use, based on the browser of the client machine that submits the report request. Where the browser is identified as an Internet Explorer browser, or the browser is unknown (such as reports distributed by ReportCaster), WebFOCUS will continue to generate Web Archive files (.mht). For all other browsers, WebFOCUS will encode the image into an HTML file (.htm).
Usage Notes for HTMLEMBEDIMG
- When HTMLEMBEDIMG is set to ON (the default setting) and HTMLARCHIVE is set to ON, the HTMLEMBEDIMG ON setting overrides the HTMLARCHIVE ON setting, and an .htm file, in which the image is embedded, is generated.
- When HTMLEMBEDIMG is set to ON (the default setting) and HTMLARCHIVE is set to OFF, an .htm file is generated and the image is embedded.
- Setting HTMLEMBEDIMG to OFF and enabling HTMLARCHIVE generates an .mht file, which contain the encoded image.
- When HTMLEMBEDIMG and HTMLARCHIVE are set to OFF, an .html file is generated, but the image is not embedded.
- The encoding algorithm that uses 64-bit encoding supported for images less than 32K in size is supported by Internet Explorer 8. For Internet Explorer 8, Information Builders recommends continuing to use the .mht format generated by HTMLARCHIVE. In Internet Explorer 9 and higher and browsers other than Internet Explorer, the new algorithm is supported for images of any size. See the browser vendor information to confirm 64-bit encoding support.
Image Attributes
Attribute |
Description |
---|---|
IMAGE |
|
IMAGEALIGN |
Positions an image. This applies only to HTML reports. |
POSITION |
Positions an image. |
IMAGEBREAK |
Controls generation of a line break after an image. This applies only to HTML reports without internal cascading style sheets. |
SIZE |
Sizes an image. |
ALT |
Supplies a description of an image for compliance with Section accessibility (Workforce Investment Act of 1998). ALT only applies to HTML reports. |
PRESERVERATIO |
ON specifies that the aspect ratio (ratio of height to width) of the image should be preserved when it is scaled to the specified SIZE. This avoids distorting the appearance of the image. The image is scaled to the largest size possible within the bounds specified by SIZE for which the aspect ratio can be maintained. Supported for images in PDF and PostScript report output. |
BACKIMAGE |
Adds a background image. |
Add an Image to an HTML Report
This syntax applies to an HTML report. For details on adding an image to a PDF, PS, or HTML report with an internal CSS, see Add an Image to a PDF, PS, or HTML Report With an Internal Cascading Style Sheet.
TYPE={REPORT|heading}, IMAGE={url|(column)} [,IMAGEALIGN=position] [,IMAGEBREAK={ON|OFF}] [,ALT='description'], $
where: StyleSheets and graphics" /> StyleSheets" />
Embeds an image in the body of a report. REPORT is the default value.
Note: The IMAGE=(column) option is not supported with TYPE=REPORT.
Embeds an image in a heading or footing. Valid values are TABHEADING, TABFOOTING, HEADING, FOOTING, SUBHEAD, and SUBFOOT.
Is the URL for the image file. The image must exist in a separate file in a format that your browser supports, such as GIF or JPEG (.jpg). The file can be on your local web server, or on any server accessible from your network. For details, see Adding an Image to a Report.
Is an alphanumeric field in a request (for example, a display field or a BY field) whose value is a URL that points to an image file. Specify a value using the COLUMN attribute described in Identifying a Report Component in an ibi WebFOCUS StyleSheet. Enclose column in parentheses.
This option enables you to add different images to a heading or footing, depending on the value of the field.
Is the position of the image.
Valid values are:
TOP
where
the top right corner of the image aligns with heading or footing
text. If the image is attached to the entire report, it appears
on top of the report.
MIDDLE
where the image
appears in the middle of the heading or footing text. If the image
is attached to the entire report, it appears in the middle of the
report.
BOTTOM
where the bottom right
corner of the image aligns with heading or footing text. If the
image is attached to the entire report, it appears at the bottom
of the report.
LEFT
where the image appears
to the left of heading or footing text. If the image is attached
to the entire report, it appears to the left of the report.
RIGHT
where
the image appears to the right of heading or footing text. If the
image is attached to the entire report, it appears to the right
of the report.
Controls generation of a line break after the image. Valid values are:
ON
which
generates a line break after the image so that an element following
it (such as, report heading text) appears on the next line.
OFF
which
suppresses a line break after the image so that an element following
it is on the same line. OFF is the default value.
Is a textual description of an image for compliance with Section 508 accessibility. Enclose the description in single quotation marks.
Specifying a URL
The following guidelines are the same for IMAGE=url and IMAGE=(column) syntax. In the latter case, they apply to a URL stored in a data source field.
Specify a URL by:
- Supplying an
absolute or relative address that points to an image file, for example:
TYPE=TABHEADING,IMAGE=http://www.tibco.com/images/logo_wf3.gif,$ TYPE=TABHEADING, IMAGE=/ibi_apps/ibi_html/ggdemo/gotham.gif,$
- Using the SET
BASEURL parameter to establish a URL that is logically prefixed
to all relative URLs in the request. With this feature, you can
add an image by specifying just its file name in the IMAGE attribute.
For example:
SET BASEURL=http://host:port/ . . . TYPE=REPORT, IMAGE=gotham.gif,$
The following apply:
- A base URL must end with a slash (/).
- An absolute URL (which begins with http://) overrides a base URL.
- A URL is case-sensitive when referring to a UNIX server.
- If the name of the image file does not contain an extension, .GIF is used.
Adding a GIF Image to an HTML Report Heading
This request adds the Gotham Grinds logo to a report heading. The logo is in a separate image file identified by a relative URL in the IMAGE attribute.
TABLE FILE GGORDER ON TABLE SUBHEAD "PRODUCTS ORDERED ON 08/01/96" SUM QUANTITY AS 'Ordered Units' BY PRODUCT WHERE PRODUCT EQ 'Coffee Grinder' OR 'Coffee Pot' WHERE ORDER_DATE EQ '08/01/96' ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=TABHEADING, IMAGE=/IBI_APPS/IBI_HTML/GGDEMO/GOTHAM.GIF, IMAGEBREAK=ON, $ ENDSTYLE END
IMAGEBREAK, set to ON, generates a line break between the logo and the heading text:
Creating a Report Heading With an Embedded JPEG Image
TABLE FILE EMPLOYEE ON TABLE SUBHEAD "Employee Salary Information and Courses" " " " " " " " " " " " " " " " " " " PRINT CURR_SAL BY COURSE_NAME ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ TYPE=TABHEADING, IMAGE=C:\IBI\APPS\IMAGES\Pencils.jpg, POSITION=(.5 .5), SIZE=(.5 .5), $ ENDSTYLE END
The output is:
Using a File Name in a Data Source Field in an HTML Report
The following illustrates how to embed an image in a SUBHEAD, and use a different image for each value of the BY field on which the SUBHEAD occurs.
DEFINE FILE CAR FLAG/A12= DECODE COUNTRY ( 'ENGLAND' 'uk' 'ITALY' 'italy' 'FRANCE' 'france' 'JAPAN' 'japan' ); END
TABLE FILE CAR PRINT FLAG NOPRINT AND MODEL AS '' BY COUNTRY NOPRINT AS '' BY CAR AS '' WHERE COUNTRY EQ 'ENGLAND' OR 'FRANCE' OR 'ITALY' OR 'JAPAN' ON COUNTRY SUBHEAD " <+0>Cars produced in <ST.COUNTRY" HEADING CENTER "Car Manufacturer Report" " " ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=SUBHEAD, IMAGE=(FLAG), $ TYPE=REPORT, GRID=OFF, $ TYPE=HEADING, SIZE=12, STYLE=BOLD, $ TYPE=SUBHEAD, STYLE=BOLD, $ ENDSTYLE END
The output is:
Supplying an Image Description Using the ALT Attribute
This request adds the Information Builders logo to a report footing. It uses the WebFOCUS StyleSheet ALT attribute to add descriptive text (Information Builders logo) that identifies the image.
TABLE FILE GGORDER SUM QUANTITY AS 'Ordered Units' BY PRODUCT ON TABLE SUBHEAD "PRODUCTS ORDERED" FOOTING " " ON TABLE SET ACCESSHTML 508 ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF,$ TYPE=FOOTING, IMAGE=/ibi_html/iblogo.gif, ALT='Information Builders logo',$ ENDSTYLE END
- Include the -MRNOEDIT command at the beginning of the line that references the IMAGE not located in the WebFOCUS repository.
- Include the fully qualified path in the IMAGE parameter.
The WebFOCUS Client Upload Images to be Embedded in Reports Applications setting specifies whether to upload Repository images to the WebFOCUS Reporting Server for embedding in reports and HTML pages. The default is to upload Repository images. For more information on the Upload Images to be Embedded in Reports Applications setting, see the ibi™ WebFOCUS® Security and Administration manual.
The -MRNOEDIT command instructs the WebFOCUS Client to not process the line of code. For more information on the -MRNOEDIT command, see the ibi™ WebFOCUS® Business Intelligence Portal manual.
When you run the request, the image displays below the report data, as shown in the following image.
When you hover the mouse over the image, the descriptive text displays in a box if your browser image loader is turned off or if the browser does not display images.
WebFOCUS generates the following HTML code for the image:
<IMG SRC="/ibi_html/ibilogo.gif" ALT="Information Builders logo">
Add a Background Image
This syntax applies to an HTML report.
[TYPE=REPORT,] BACKIMAGE=url, $
where: StyleSheets and adding graphics" />
Applies the image to the entire report. Not required, as it is the default.
Is the URL of a GIF or JPEG file (.jpg). Specify a file on your local web server, or on a server accessible from your network.
The URL can be an absolute or relative address. See Adding an Image to a Report.
When specifying a GIF file, you can omit the file extension.
Adding a Background Image
This request adds a background image to a report. The image file CALM_BKG.GIF resides in the relative address shown.
TABLE FILE GGSALES SUM UNITS DOLLARS BY CATEGORY BY PRODUCT ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT, STYLE=BOLD, GRID=OFF, $ TYPE=REPORT, BACKIMAGE=/IBI_APPS/IBI_HTML/TEMPLATE/CALM_BKG.GIF, $ ENDSTYLE END
The background is tiled across the report area:
Add an Image to a PDF, PS, or HTML Report With an Internal Cascading Style Sheet
This syntax applies to a PDF, PS, or HTML report with an internal cascading style sheet. The image can be in a separate file. StyleSheets and graphics" />
A report with an Internal cascading style sheet is an HTML page with an HTML cascading style sheet (CSS) stored between the style tags within the HTML document.
TYPE={REPORT|heading}, IMAGE={url|file|(column)} [,BY=byfield] [,POSITION=([+|-]x [+|-]y )] [,SIZE=(w h)] ,$
where:
Embeds an image in the body of a report. The image appears in the background of the report. REPORT is the default value.
Embeds an image in a heading or footing. Valid values are TABHEADING, TABFOOTING, FOOTING, HEADING, SUBHEAD, and SUBFOOT.
Provide sufficient blank space in the heading or footing so that the image does not overlap the heading or footing text. Also, you may want to place heading or footing text to the right of the image using spot markers or the POSITION attribute in the StyleSheet.
HTML report with internal cascading style sheet:
Is the absolute or relative address for the image file. The image must exist in a separate file in a format that your browser supports, such as GIF or JPEG (.jpg). The file can be on your local web server, or on any server accessible from your network. For details, see Adding an Image to a Report.
PDF or PS report:
Is the name of the image file. It must reside on the WebFOCUS Reporting Server in a directory named on EDAPATH or APPPATH. If the file is not on the search path, supply the full path name.
When specifying a GIF file, you can omit the file extension.
Is an alphanumeric field in the data source that contains the name of an image file. Use the COLUMN attribute described in Identifying a Report Component in an ibi WebFOCUS StyleSheet. Enclose column in parentheses.
The field containing the file name or image must be a display field or BY field referenced in the request.
Note that the value of the field is interpreted exactly as if it were typed as the URL of the image in the StyleSheet. If you omit the suffix, .GIF is supplied by default. SET BASEURL can be useful for supplying the base URL of the images. If you do that, the value of the field does not have to include the complete URL.
This syntax is useful, for example, if you want to embed an image in a SUBHEAD, and you want a different image for each value of the BY field on which the SUBHEAD occurs.
Is the sort field that generated the subhead or subfoot.
Is the starting position of the image.
Measures the horizontal or vertical distance from the upper-left corner of the report component in which the image is embedded.
Is the horizontal starting position of the image from the upper-left corner of the physical report page, expressed in the unit of measurement specified by the UNITS parameter.
Enclose the x and y values in parentheses. Do not include a comma between them.
Is the vertical starting position of the image from the upper-left corner of the physical report page, expressed in the unit of measurement specified by the UNITS parameter.
Is the size of the image. By default, an image is added at its original size.
Is the width of the image, expressed in the unit of measurement specified by the UNITS parameter.
Enclose the w and h values in parentheses. Do not include a comma between them.
Is the height of the image, expressed in the unit of measurement specified by the UNITS parameter.
Adding a GIF Image to an HTML Report With Internal Cascading Style Sheet
A URL locates the image file GOTHAM.GIF on a server named WEBSRVR1. The TYPE attribute adds the image to the report heading. POSITION places the image one-quarter inch horizontally and one-tenth inch vertically from the upper-left corner of the report page. The image is one inch wide and one inch high as specified by SIZE.
SET HTMLCSS = ON TABLE FILE GGSALES SUM UNITS BY PRODUCT ON TABLE SUBHEAD "REPORT ON UNITS SOLD" " " " " " " " " " " ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ TYPE=TABHEADING, IMAGE=HTTP://WEBSRVR1/IBI_APPS/IBI_HTML/GGDEMO/GOTHAM.GIF, POSITION=(.25 .10), SIZE=(1 1), $ ENDSTYLE END
The company logo is positioned and sized in the report heading:
Adding a GIF Image to a PDF Report
The image file for this example is GOTHAM.GIF. The POSITION attribute places the image one-quarter inch horizontally and one-quarter vertically from the upper-left corner of the report page. The image is one-half inch wide and one-half inch high as specified by SIZE.
SET ONLINE-FMT = PDF TABLE FILE GGSALES SUM UNITS BY PRODUCT ON TABLE SUBHEAD "Report on Units Sold" " " " " " " " " " " ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=TABHEADING, IMAGE=GOTHAM.GIF, POSITION=(.25 .25), SIZE=(.5 .5), $ ENDSTYLE END
The report is:
Adding a PNG Image to a PDF Report
The image file for this sample is Ibi_logo.png. The POSITION attribute places the image to the upper-left corner of the report page. The image is one inch wide and half an inch high, as specified by SIZE.
SET HTMLCSS = ON TABLE FILE GGSALES SUM UNITS BY PRODUCT ON TABLE SUBHEAD "REPORT ON UNITS SOLD" " " " " " " " " " " ON TABLE SET PAGE-NUM OFF ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ TYPE=TABHEADING, IMAGE=Ibi_logo.png, POSITION=(0 .30), SIZE=(1 0.5), $ ENDSTYLE END
The report is:
Add an Image From a BLOB Field to a PDF, DHTML, or HTML Report
For PDF, HTML, and DHTML output against data sources that support the Binary Large Object (BLOB) data type (Microsoft SQL Server, DB2, Oracle, Informix, and PostgreSQL using its BYTEA data type), an image can be stored in a BLOB field in the data source. StyleSheets and graphics" />
WebFOCUS StyleSheets used to produce report output in PDF, HTML, or DHTML format can access a BLOB field as an image source when an instance of the BLOB field contains an exact binary copy of a GIF or JPG image. HTML and DHTML reports also support PNG images. Images of different formats (GIF, JPG, PNG) can be mixed within the same BLOB field. WebFOCUS can determine the format from the header of the image. The image can be inserted in report columns, headings, footings, subheadings, and subfootings.
The BLOB field must be referenced in a PRINT or LIST command in the request (aggregation is not supported). Reports containing BLOB images are supported as components in Coordinated Compound Reports.
With the following SET commands, BLOB images will work for both HTML and DHTML in all browsers:
- SET HTMLEMBEDIMG=AUTO.
- SET HTMLARCHIVE=ON (required to support Internet Explorer with images larger than 32K).
- SET BASEURL='' (required to make embedded images work as it overrides the default setting sent from the WebFOCUS Client).
- SET HTMLCSS=ON (required for image positioning in subheads in HTML reports). Setting HTMLCSS=ON creates an HTML report with an Internal cascading style sheet. A report with an Internal cascading style sheet is an HTML page with an HTML cascading style sheet (CSS) stored between the style tags within the HTML document.
TYPE={REPORT|heading}, IMAGE={url|file|(column)} [,BY=byfield] [,POSITION=([+|-]x [+|-]y )] [,SIZE=(w h)] [,PRESERVERATIO={ON|OFF}],$
TYPE=DATA, COLUMN=imagefield, IMAGE=(imagefield), SIZE=(wh) [,PRESERVERATIO={ON|OFF}] ,$
where:
Embeds an image in the body of a report. The image appears in the background of the report. REPORT is the default value (not supported for images stored in BLOB fields, which are supported for PDF output).
Embeds an image in a heading or footing. Valid values are FOOTING, HEADING, SUBHEAD, and SUBFOOT.
If the image is to be embedded in a heading, subheading, footing, or subfooting rather than a column, the StyleSheet declaration is responsible for placing the image in the heading, subheading, footing, or subfooting. To make the BLOB image accessible to the StyleSheet, the BLOB field must be referenced in the PRINT or LIST command with the NOPRINT option. Do not reference the BLOB field name in the heading or footing itself.
Provide sufficient blank space in the heading or footing so that the image does not overlap the heading or footing text. Also, you may want to place heading or footing text to the right of the image using spot markers or the POSITION attribute in the StyleSheet.
Is the name of the image file. It must reside on the WebFOCUS Reporting Server in a directory named on EDAPATH or APPPATH. If the file is not on the search path, supply the full path name.
When specifying a GIF file, you can omit the file extension.
Is a BLOB field in the data source that contains an exact binary copy of a GIF or JPG image. HTML and DHTML formats also support images in PNG format. Images of different formats (GIF, JPG, PNG) can be mixed within the same BLOB field. WebFOCUS can determine the format from the header of the image. The image can be inserted in report columns, headings, footings, subheadings and subfootings. Use the COLUMN attribute described in Identifying a Report Component in an ibi WebFOCUS StyleSheet. Enclose column in parentheses.
The field containing the file name or image must be a display field or BY field referenced in the request.
Is the sort field that generated the subhead or subfoot.
Is any valid column reference for the BLOB field that contains the image. Note that the BLOB field must be referenced in a PRINT or LIST command in the request.
If omitted, the default size is 1 inch by 1 inch. The width of the column and the spacing between the lines is automatically adjusted to accommodate the image.
Is the starting position of the image.
Measures the horizontal or vertical distance from the upper-left corner of the report component in which the image is embedded.
Is the horizontal starting position of the image from the upper-left corner of the physical report page, expressed in the unit of measurement specified by the UNITS parameter.
Enclose the x and y values in parentheses. Do not include a comma between them.
Is the vertical starting position of the image from the upper-left corner of the physical report page, expressed in the unit of measurement specified by the UNITS parameter.
Is the size of the image. By default, an image is added at its original size. Note that images stored in BLOB fields are supported only for PDF, HTML, and DHTML output.
Is the width of the image, expressed in the unit of measurement specified by the UNITS parameter.
Enclose the w and h values in parentheses. Do not include a comma between them.
Is the height of the image, expressed in the unit of measurement specified by the UNITS parameter.
If SIZE is omitted, the original dimensions of the image are used (any GIF, JPG, or PNG image has an original, unscaled size based on the dimensions of its bitmap).
OFF
}]
Not supported for images in PNG format. PRESERVERATIO=ON specifies that the aspect ratio (ratio of height to width) of the image should be preserved when it is scaled to the specified SIZE. This avoids distorting the appearance of the image. The image is scaled to the largest size possible within the bounds specified by SIZE for which the aspect ratio can be maintained. Supported for PDF and PS output. OFF does not maintain the aspect ratio. OFF is the default value.
The actual size of an image stored in a BLOB field may vary from image to image, and scaling the images to a designated size allows them to better fit into a columnar report. Note: Images stored in a BLOB field are supported only for PDF, HTML, and DHTML output.
Inserting an Image From a BLOB Field Into a Report Column
The Microsoft SQL Server data source named retaildetail contains product information for a sports clothing and shoe retailer. The Microsoft SQL Server data source named retailimage has the same product ID field as retaildetail and has an image of each product stored in a field named prodimage whose data type is BLOB.
The following Master File describes the Microsoft SQL Server data source named retaildetail.
FILENAME=RETAILDETAIL, SUFFIX=SQLMSS , $ SEGMENT=SEG01, SEGTYPE=S0, $ FIELDNAME=FOCLIST, ALIAS=FOCLIST, USAGE=I5, ACTUAL=I4, $ FIELDNAME=PRODUCTID, ALIAS=ProductId, USAGE=A5, ACTUAL=A5, MISSING=ON, $ FIELDNAME=DEPARTMENT, ALIAS=Department, USAGE=A10, ACTUAL=A10, MISSING=ON, $ FIELDNAME=CATEGORY, ALIAS=Category, USAGE=A30, ACTUAL=A30, MISSING=ON, $ FIELDNAME=SPORTS, ALIAS=Sports, USAGE=A30, ACTUAL=A30, MISSING=ON, $ FIELDNAME=GENDER, ALIAS=Gender, USAGE=A10, ACTUAL=A10, MISSING=ON, $ FIELDNAME=BRAND, ALIAS=Brand, USAGE=A25, ACTUAL=A25, MISSING=ON, $ FIELDNAME=STYLE, ALIAS=Style, USAGE=A25, ACTUAL=A25, MISSING=ON, $ FIELDNAME=COLOR, ALIAS=Color, USAGE=A25, ACTUAL=A25, MISSING=ON, $ FIELDNAME=NAME, ALIAS=Name, USAGE=A80, ACTUAL=A80, MISSING=ON, $ FIELDNAME=DESCRIPTION, ALIAS=Description, USAGE=A1000, ACTUAL=A1000, MISSING=ON, $ FIELDNAME=PRICE, ALIAS=Price, USAGE=D7.2, ACTUAL=D8, MISSING=ON, $
The following Master File describes the Microsoft SQL Server data source named retailimage, which has the same product ID field as retaildetail and has an image of each product stored in a field named prodimage whose data type is BLOB.
FILENAME=RETAILIMAGE, SUFFIX=SQLMSS , $ SEGMENT=RETAILIMAGE, SEGTYPE=S0, $ FIELDNAME=PRODUCTID, ALIAS=PRODUCTID, USAGE=A5, ACTUAL=A5, $ FIELDNAME=PRODIMAGE, ALIAS=F02BLOB50000, USAGE=BLOB, ACTUAL=BLOB, MISSING=ON, $
The following request joins the two data sources and prints product names and prices with the corresponding image. The output is generated in DHTML format.
-* Rel 7705 DHTML and HTML supports including Image stored in -* BLOB field in report column, heading, footing, subhead, or -* subfoot -* Rel 769 supports PDF format JOIN PRODUCTID IN RETAILDETAIL TO PRODUCTID IN RETAILIMAGE TABLE FILE RETAILDETAIL HEADING CENTER "Product List" " " PRINT NAME/A20 PRICE PRODIMAGE AS 'PICTURE' BY PRODUCTID NOPRINT BY NAME NOPRINT ON NAME UNDER-LINE 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 DHTML ON TABLE SET STYLE * TYPE=REPORT,COLOR=BLUE,FONT=ARIAL, GRID=OFF,$ TYPE=HEADING, SIZE = 18, COLOR=RED,$ TYPE=DATA,COLUMN=PRODIMAGE,IMAGE=(PRODIMAGE),SIZE=(1 1),$ ENDSTYLE END
The image is placed in the report column using the following StyleSheet declaration, which names the image field, and establishes the size and position in the column for the image.
TYPE=DATA,COLUMN=PRODIMAGE,IMAGE=(PRODIMAGE),SIZE=(1 1),$
The partial output shows that DHTML format preserves the specified spacing.
The following request generates the output in HTML format.
-* Rel 7705 DHTML and HTML supports including Image stored in -* BLOB field in report column, heading, footing, subhead, or -* subfoot -* Rel 769 supports PDF format JOIN PRODUCTID IN RETAILDETAIL TO PRODUCTID IN RETAILIMAGE TABLE FILE RETAILDETAIL HEADING CENTER "Product List" " " PRINT NAME/A20 PRICE PRODIMAGE AS 'PICTURE' BY PRODUCTID NOPRINT BY NAME NOPRINT ON NAME UNDER-LINE 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, GRID=OFF, FONT=ARIAL,$ TYPE=HEADING, SIZE = 18, COLOR=RED,$ TYPE=DATA,COLUMN=PRODIMAGE,IMAGE=(PRODIMAGE),SIZE=(1 1),$ ENDSTYLE END
The partial output shows that the spacing is different because the browser removes blank spaces for HTML report output.
The following request generates the report output in PDF format.
-* Rel 7705 DHTML and HTML supports including Image stored in -* BLOB field in report column, heading, footing, subhead, or -* subfoot -* Rel 769 supports PDF format JOIN PRODUCTID IN RETAILDETAIL TO PRODUCTID IN RETAILIMAGE TABLE FILE RETAILDETAIL HEADING CENTER "Product List" " " PRINT NAME/A20 PRICE PRODIMAGE AS 'PICTURE' BY PRODUCTID NOPRINT BY NAME NOPRINT ON NAME UNDER-LINE 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 PDF ON TABLE SET STYLE * TYPE=REPORT,COLOR=BLUE, GRID=OFF,$ TYPE=HEADING, SIZE = 18, FONT = ARIAL, COLOR=RED,$ TYPE=DATA,COLUMN=PRODIMAGE,IMAGE=(PRODIMAGE),SIZE=(1 1),$ ENDSTYLE END
The PDF partial output preserves specified spacing providing results similar to DHTML output.
Inserting an Image From a BLOB Field Into a Subheading
The Microsoft SQL Server data source named retaildetail contains product information for a sports clothing and shoe retailer. The Microsoft SQL Server data source named retailimage has the same product ID field as retaildetail and has an image of each product stored in a field named prodimage whose data type is BLOB.
The following request joins the two data sources and prints product images in a subheading. The output is generated in DHTML format. It can also be generated in HTML or PDF format.
-* Rel 7705 DHTML and HTML supports including Image stored in -* BLOB field in HTML report column, heading, footing, subhead, -* or subfoot -* Rel 769 supports PDF format -*SET BASEURL='' - Required for embedded images to work. Overrides default -* setting from WF Client. SET BASEURL='' JOIN PRODUCTID IN RETAILDETAIL TO PRODUCTID IN RETAILIMAGE TABLE FILE RETAILDETAIL HEADING CENTER "Product Catalog" " " PRINT NAME NOPRINT PRODIMAGE NOPRINT BY PRODUCTID NOPRINT ON PRODUCTID SUBHEAD "" " ID: <10<PRODUCTID " " Name: <10<NAME " " Price: <7<PRICE " " Image: " "" "" "" "" "" 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 DHTML ON TABLE SET STYLE * TYPE=REPORT,COLOR=BLUE,FONT = ARIAL,$ TYPE=HEADING, COLOR = RED, SIZE = 16, JUSTIFY=CENTER,$ TYPE=SUBHEAD,BY=PRODUCTID,IMAGE=(PRODIMAGE),SIZE=(1 1), POSITION=(+2 +1),$ ENDSTYLE END
The partial output is.
Sizing an Image From a BLOB Field
The Microsoft SQL Server data source named retaildetail contains product information for a sports clothing and shoe retailer. The Microsoft SQL Server data source named retailimage has the same product ID field as retaildetail and has an image of each product stored in a field named prodimage whose data type is BLOB.
The following request joins the two data sources and displays the same image on three columns of output using different sizes and different PRESERVERATIO settings. Note that PRESERVERATIO=ON is not supported with images in PNG format.
The output is generated in DHTML format. It can also be generated in HTML or PDF format.
-* Rel 7705 DHTML and HTML supports including Image stored in -* BLOB field in report column, heading, footing, subhead, or -* subfoot -* Rel 769 supports PDF format JOIN PRODUCTID IN RETAILDETAIL TO PRODUCTID IN RETAILIMAGE TABLE FILE RETAILDETAIL PRINT PRODIMAGE AS '' PRODIMAGE AS '' PRODIMAGE AS '' BY STYLE NOPRINT WHERE NAME CONTAINS 'Pant' OR 'Tank' ON STYLE UNDER-LINE 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 DHTML ON TABLE SET STYLE * TYPE=REPORT,COLOR=BLUE,FONT = ARIAL,$ TYPE=DATA,COLUMN=P1,IMAGE=(PRODIMAGE),SIZE=(.75 .75),$ TYPE=DATA,COLUMN=P2,IMAGE=(PRODIMAGE),SIZE=(.75 1),PRESERVERATIO=ON,$ TYPE=DATA,COLUMN=P3,IMAGE=(PRODIMAGE),SIZE=(.75 1),PRESERVERATIO=OFF,$ ENDSTYLE END
Note that PRESERVERATIO=OFF is specified for the second column to preserve the image height and width ratio for that column even though the styling SIZE height specifies a different value than the first column image styling. In addition, PRESERVERATIO=OFF is specified for the third column, so for that column the image height to width ratio is not preserved and is rendered as specified by the styling SIZE height and width values specified in the request (FEX).
The partial output follows.
Inserting an Image From a BLOB Field in a Summary Report
In order to insert an image from a BLOB field in a report that displays summary data, you must include two display commands in the request, a SUM command for the summary information and a PRINT or LIST command for displaying the image and any other detail data.
The Microsoft SQL Server data source named retaildetail contains product information for a sports clothing and shoe retailer. The Microsoft SQL Server data source named retailimage has the same product ID field as retaildetail and has an image of each product stored in a field named prodimage whose data type is BLOB.
The following request joins the two data sources. It contains two display commands, a SUM command and a PRINT command. The SUM command aggregates the total price for each category and displays this category name and total price in a subheading, The PRINT command displays the image for each item in the category along with its individual product number and price in a subfooting.
The output is generated in DHTML format. It can also be generated in HTML or PDF format.
-* Rel 7705 DHTML and HTML supports including images stored in -* BLOB field in report column, heading, footing, subhead, or -* subfoot -* Rel 769 supports PDF format SET PRINTPLUS=ON JOIN PRODUCTID IN RETAILDETAIL TO PRODUCTID IN RETAILIMAGE TABLE FILE RETAILDETAIL HEADING CENTER "Product Price Summary" " " SUM PRICE NOPRINT BY CATEGORY NOPRINT ON CATEGORY SUBHEAD " Category: <CATEGORY " " Total Price: <PRICE " " "
PRINT PRICE NOPRINT PRODIMAGE NOPRINT BY CATEGORY NOPRINT BY PRODUCTID NOPRINT ON PRODUCTID SUBFOOT " " " " " " " " " " " " " Product #: <PRODUCTID " " Name: <NAME " " Price: <FST.PRICE " 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 DHTML ON TABLE SET STYLE * TYPE=REPORT,COLOR=BLUE,FONT=ARIAL,$ TYPE=HEADING, COLOR=RED, SIZE=14, STYLE=BOLD, JUSTIFY=CENTER,$ TYPE=SUBHEAD, COLOR=RED, SIZE=12, STYLE=BOLD, JUSTIFY=CENTER,$ TYPE=SUBFOOT,BY=PRODUCTID,IMAGE=(PRODIMAGE),SIZE=(1 1), POSITION=(0 0),$ TYPE=SUBFOOT,BY=PRODUCTID,OBJECT=FIELD, ITEM=1, WRAP=5,$ ENDSTYLE END
The output for the first category is:
File Size and Compression Considerations For Images in BLOB Fields
The actual size of an image stored in the BLOB field may vary from image to image, and scaling the images to a designated size allows them to better fit into a columnar report.
Files that contain many images can be large. Scaling the images to a smaller size using the SIZE attribute does not decrease the size of the file. Note also that using SET FILECOMPRESS=ON will not reduce the size of images in a PDF file, since images are already saved in compressed form.