Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Embedding images
Embedding images [message #67395] Thu, 11 August 2005 17:54 Go to next message
Joe Rybacki is currently offline Joe RybackiFriend
Messages: 36
Registered: July 2009
Member
In postgres i'm storing images as bytea types. I'm selecting the data from
the
document table and when I go to access it and create an image in the report
from
it it won't render. I've traced the problem down to these lines in
ImageItemExecutor.java :

byte[] blob = null;
if ( value != null && value.getClass( ).isArray( ) &&
value.getClass( ).getComponentType( ) == byte.class ) {
blob = (byte[]) value;
}

These lines effectively limit the type of the column containing the image
data
to blobs. THe problem is blobs aren't that great in postgres and have tons
of
problems. So I use bytea objects that come back as strings in BIRT. I'm
trying
to embed an image in the report. via this tag:

<image source="expr">
<expression name="typeExpr">row["mimeType"]</expression>
<expression name="valueExpr">row["donorPicture"]</expression>
</image>Anyone figured this out? I'm going to try patching
ImageItemExecutor
Re: Embedding images [message #67627 is a reply to message #67395] Thu, 11 August 2005 22:59 Go to previous messageGo to next message
Joe Rybacki is currently offline Joe RybackiFriend
Messages: 36
Registered: July 2009
Member
Upon further investigation, the problem is actually related to how the image
is read from the db. The bytea is converted to a string without respecting
the encoding effectively destroying the image.

"Joe Rybacki" <Joe.Rybacki@dynetics.com> wrote in message
news:ddg3dl$370$1@news.eclipse.org...
>
> In postgres i'm storing images as bytea types. I'm selecting the data
> from the
> document table and when I go to access it and create an image in the
> report from
> it it won't render. I've traced the problem down to these lines in
> ImageItemExecutor.java :
>
> byte[] blob = null;
> if ( value != null && value.getClass( ).isArray( ) &&
> value.getClass( ).getComponentType( ) == byte.class ) {
> blob = (byte[]) value;
> }
>
> These lines effectively limit the type of the column containing the image
> data
> to blobs. THe problem is blobs aren't that great in postgres and have
> tons of
> problems. So I use bytea objects that come back as strings in BIRT. I'm
> trying
> to embed an image in the report. via this tag:
>
> <image source="expr">
> <expression name="typeExpr">row["mimeType"]</expression>
> <expression name="valueExpr">row["donorPicture"]</expression>
> </image>Anyone figured this out? I'm going to try patching
> ImageItemExecutor
>
Re: Embedding images [message #67742 is a reply to message #67627] Fri, 12 August 2005 14:49 Go to previous messageGo to next message
Joe Rybacki is currently offline Joe RybackiFriend
Messages: 36
Registered: July 2009
Member
Well, I finally figured it out, I had to change 3 birt jars. data,
data.oda, and report.data.oda.jdbc, the plugin.xml and manually edit my
report. I"ve attached the source changes in 3 zip files. Basically the
problem was that the binary column was converted to a string effectively
destroying the image coming out of the database. Also had to support the
byte array as an oda type.

The plugin.xml change for report.oda.jdbc:
FROM:
<dataTypeMapping
nativeDataType="BINARY"
nativeDataTypeCode="-2"
odaScalarDataType="String"/>
To:

<dataTypeMapping
nativeDataType="BINARY"
nativeDataTypeCode="-2"
odaScalarDataType="byte"/>

To embed the image element as an expression in the report file:

<image source="expr">

<expression name="typeExpr">row["mimeType"]</expression>

<expression name="valueExpr">row["picture"]</expression>

</image>

Hope this helps, Maybe this could be incorporated into the birt source code.

Thanks,
Joe

"Joe Rybacki" <Joe.Rybacki@dynetics.com> wrote in message
news:ddgl8o$mef$1@news.eclipse.org...
> Upon further investigation, the problem is actually related to how the
> image
> is read from the db. The bytea is converted to a string without
> respecting
> the encoding effectively destroying the image.
>
> "Joe Rybacki" <Joe.Rybacki@dynetics.com> wrote in message
> news:ddg3dl$370$1@news.eclipse.org...
>>
>> In postgres i'm storing images as bytea types. I'm selecting the data
>> from the
>> document table and when I go to access it and create an image in the
>> report from
>> it it won't render. I've traced the problem down to these lines in
>> ImageItemExecutor.java :
>>
>> byte[] blob = null;
>> if ( value != null && value.getClass( ).isArray( ) &&
>> value.getClass( ).getComponentType( ) == byte.class ) {
>> blob = (byte[]) value;
>> }
>>
>> These lines effectively limit the type of the column containing the image
>> data
>> to blobs. THe problem is blobs aren't that great in postgres and have
>> tons of
>> problems. So I use bytea objects that come back as strings in BIRT. I'm
>> trying
>> to embed an image in the report. via this tag:
>>
>> <image source="expr">
>> <expression name="typeExpr">row["mimeType"]</expression>
>> <expression name="valueExpr">row["donorPicture"]</expression>
>> </image>Anyone figured this out? I'm going to try patching
>> ImageItemExecutor
>>
>
>




Re: Embedding images [message #67864 is a reply to message #67742] Fri, 12 August 2005 23:19 Go to previous message
Linda ChanFriend
Messages: 845
Registered: July 2009
Senior Member
Hi Joe,

Thanks for your contribution.
We are indeed planning to add support of the BLOB and CLOB data types in BIRT and the ODA framework in the next release.
See Bugzilla #95793: https://bugs.eclipse.org/bugs/show_bug.cgi?id=95793

Linda

Joe Rybacki wrote:

> Well, I finally figured it out, I had to change 3 birt jars. data,
> data.oda, and report.data.oda.jdbc, the plugin.xml and manually edit my
> report. I"ve attached the source changes in 3 zip files. Basically the
> problem was that the binary column was converted to a string effectively
> destroying the image coming out of the database. Also had to support the
> byte array as an oda type.
>
> The plugin.xml change for report.oda.jdbc:
> FROM:
> <dataTypeMapping
> nativeDataType="BINARY"
> nativeDataTypeCode="-2"
> odaScalarDataType="String"/>
> To:
>
> <dataTypeMapping
> nativeDataType="BINARY"
> nativeDataTypeCode="-2"
> odaScalarDataType="byte"/>
>
> To embed the image element as an expression in the report file:
>
> <image source="expr">
>
> <expression name="typeExpr">row["mimeType"]</expression>
>
> <expression name="valueExpr">row["picture"]</expression>
>
> </image>
>
> Hope this helps, Maybe this could be incorporated into the birt source code.
>
> Thanks,
> Joe
>
>
> Name: org.eclipse.birt.report.data.oda.jdbc-changes.zip
> org.eclipse.birt.report.data.oda.jdbc-changes.zip Type: WinZip File (application/x-unknown-content-type-WinZip)
> Encoding: x-uuencode
>
> Name: org.eclipse.birt.data.oda-changes.zip
> org.eclipse.birt.data.oda-changes.zip Type: WinZip File (application/x-unknown-content-type-WinZip)
> Encoding: x-uuencode
>
> Name: org.eclipse.birt.data-changes.zip
> org.eclipse.birt.data-changes.zip Type: WinZip File (application/x-unknown-content-type-WinZip)
> Encoding: x-uuencode
Previous Topic:RHINO USAGE WARNING
Next Topic:PDF report with bookmark ?
Goto Forum:
  


Current Time: Sat Oct 19 14:14:55 GMT 2024

Powered by FUDForum. Page generated in 0.03764 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top