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

Image in a table column #12

Open
GeorgeD19 opened this issue Feb 15, 2019 · 17 comments
Open

Image in a table column #12

GeorgeD19 opened this issue Feb 15, 2019 · 17 comments

Comments

@GeorgeD19
Copy link

GeorgeD19 commented Feb 15, 2019

Is there any way on inserting an image into a table column? What about multiple images in a single row?

@GeorgeD19 GeorgeD19 changed the title Table image in column Image in a table column Feb 15, 2019
@alhman
Copy link
Contributor

alhman commented Mar 22, 2019

Right now a table is only meant for simple tabular text display. If you need more complex layouts you can use sections which are more flexible.

@4t4nner
Copy link

4t4nner commented Apr 2, 2020

How add various images with data when I generate report?

# data.toImageSectionData[0].image is a base64 image
report = Report(report_definition, data, is_test_data, additional_fonts=additional_fonts)

when I add image to template, get something like this - the same picture in multiple rows of section

@alhman
Copy link
Contributor

alhman commented Apr 3, 2020

you can pass images as base64 encoded or I/O object. See data parameter in the method documentation

@4t4nner
Copy link

4t4nner commented Apr 8, 2020

you can pass images as base64 encoded or I/O object

What type should I use for it in frontend? List type contains only simple types. I need various picture for each section row.

I want to do smth like this

If I use List->Text field in frontend to pass base64 image from dataset I get an error (it looks for image type, I guess).
If I change type of text field to image

# 'test_image' = $items[0]['preview']
ptType = copy(report.context.parameters['test_image'].type)
report.context.parameters['items'].fields['preview'].type = ptType

It works normally, and set base64 image from dataset without errors.

Why option 'List'->'Image' not included in type select input , can I add it by some settings?

@alhman
Copy link
Contributor

alhman commented Apr 8, 2020

you're right, Image type should be allowed in a list. We will add this in the next version.

With a text parameter used for an image you can pass a url (starting with "https://" or "http://"). In the next version we'll also allow specifying a file path (starting with "file:" ).

@lachlanhickey
Copy link

With a text parameter used for an image you can pass a url (starting with "https://" or "http://"). In the next version we'll also allow specifying a file path (starting with "file:" ).

Is it possible to have the image specified via a URL load within the builder? Ie, i wish to see the image whilst I'm editing

@alhman
Copy link
Contributor

alhman commented Apr 9, 2020

there is no preview of image links in the Designer. You could download the file and select it for the image file. Then you get a preview and for rendering the image link will be used.

@lachlanhickey
Copy link

Thanks for your response. Is there a way to integrate the loading of an image via a URL?

It does make it difficult to design a report around an image that is only seen as a box. A scenario would be a dynamic background image that is loaded, that has placeholder spaces. I need to be able to place (on top of the image/background) certain fields.

@alhman
Copy link
Contributor

alhman commented Apr 20, 2020

image preview for images specified by url is now supported

@lachlanhickey
Copy link

Thank you for all these new features/bugfixes. These are fantastic!!

@lachlanhickey
Copy link

Further to the above, should I be able to have an image, with the 'Source' being from a dynamic parameter such as a URL?

@alhman
Copy link
Contributor

alhman commented Apr 20, 2020

you can have a parameter (type: text) which contains the url and an image with the source containing the parameter. The image will be shown when the report is generated. The preview does only work in case the url is directly set as image source and not by parameter because the parameter is evaluated at runtime.

So I guess that's still a problem in your case? We'll see if we can use the parameter test data for image preview in case a parameter is used.

@lachlanhickey
Copy link

The preview is not an issue in this instance.

However, I think I found a further 'bug'. The suggested function only works if it is not a child object.

Only top-level parameters seem to work in the suggested manner. If I am using a child as the image source I get a 'Parameter not found' error.

@alhman
Copy link
Contributor

alhman commented Apr 21, 2020

You're right, when the parameter (containing the image url) used for image source belongs to a collection parameter it doesn't work. We'll try to fix this with the next update.

@alhman
Copy link
Contributor

alhman commented Jul 16, 2020

Using a parameter with image url inside a collection is now possible with the latest release 1.5.0

@mkusy
Copy link

mkusy commented Jul 9, 2021

Hello! I try to display an image in the table column with following steps:

  1. I've added a Table to my report.
  2. In the Designer, I've added a Parameter - the List corresponding to the table data source.
  3. I've set the type of one of the parameters from the list to Image.
  4. I've set the corresponding column's Text to use the parameter mentioned above.
  5. I send the generation request to my backend where I set the value of the parameter (3) to base64-encoded image data accordingly.
  6. I forward the request to the ReportBro server.

As a result, I would expect my images to be rendered in the table column/rows. Unfortunately, I see that my cell contains the base64-encoded image data displayed as a string.

What am I doing wrong?

@alhman
Copy link
Contributor

alhman commented Aug 16, 2021

You should use a section because images in tables are not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants