Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add controler to simply use image in fields.binary #7

Open
kryskool opened this issue Jun 4, 2014 · 6 comments
Open

Add controler to simply use image in fields.binary #7

kryskool opened this issue Jun 4, 2014 · 6 comments
Labels
Milestone

Comments

@kryskool
Copy link
Contributor

kryskool commented Jun 4, 2014

Sinc V7 we have images of products, but we cannot directly use it in Jasper, because there was encode in base64 in the database,

Add new controler call url /jasper and display method to see the photo like we can do with a web browser

@kryskool kryskool added this to the 7.2 milestone Jun 4, 2014
@kryskool kryskool self-assigned this Jun 4, 2014
@BT-astauder
Copy link

Do you want to have the photo in a PDF? Then I have a solution for a configuration.

But I have never tried if it works also in a HTML report...

@kryskool
Copy link
Contributor Author

kryskool commented Jun 4, 2014

Not yet, but when you add an image on iReport or Jasper Studio, just set on "Image expression" an address starts with http://...

On a test instance you can be like this one 'http://localhost:8069/jasper/display/product.product/image_small/15'

method: display
object: product.product
binary field: image_small
id of the product: 15

@BT-astauder
Copy link

After the properties (before the parameters) I added:
<import value="org.apache.commons.codec.binary.Base64"/>

Then define a image as follow (assuming that base64 encoded image is in 'signature'):
<image>
<reportElement x="254" y="13" width="301" height="101" uuid="29833ccf-c55d-4fa5-8502-bae6ea476344"/>
<imageExpression>
<![CDATA[new ByteArrayInputStream(new Base64().decodeBase64($F{signature}.getBytes("UTF-8")))]]>
</imageExpression>
</image>

@kryskool
Copy link
Contributor Author

kryskool commented Jun 4, 2014

I have test this some month ago, but i always have an error, what can of type is $F{signature} ?

Thanks for the reply
Regards,

@BT-astauder
Copy link

It's a string:

&lt;field name="signature" class="java.lang.String">
    &lt;fieldDescription>&lt;![CDATA[signature]]>&lt;/fieldDescription>
&lt;/field>

@kryskool
Copy link
Contributor Author

kryskool commented Jun 4, 2014

Ok it's not a blob

@kryskool kryskool removed their assignment Dec 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants