1

I created a report using the Forena module. In this report I want to display image which is saved in a private folder. I am fetching the image url from the file_managed table using file_load() method on the basis of file id.

How can I display the image in my report?

  • I want to display a image which is saved in private folder, so i am fetching image url from file_managed using file_load() method on the basis of file id. – Sonvir Choudhary Jan 17 '17 at 14:24
1

1. Display an image with a hardcoded path

The body of a Forena report is an XHTML file, which you can edit using the WYSIWYG report editor (ie the layout tab). So if you just add an image tag with a path pointing to your image, you can display such image anywhere in your report.

2. Transform the hardcoded image path into a Skin configuration option

Using Report Skins, you can use the technique of Defining skin configuration options. This allows for defining arbitrary variables that can be referenced in reports using the skin data context.

For example, assume you define a variable in the skin like so:

imagepath = path/to/image

Anywhere in your report, you can then refer to the token {skin.imagepath}.

3. Create a separate data block

If it makes sense for this specific question, you might want to consider just creating a separate (additional) data block related to the image to be displayed. That way you just retrieve the relevant data (row) from your file_managed table (as in your question), and surround it with whatever HTML markup you'd want.

4. Available FORENA hooks for adding reporting extensions

Yet another option might be to use some of the available Forena hooks. Here are some of them that may help you:

  • hook_forena_data_alter
  • hook_forena_parameters_alter

Disclosure: I'm a Forena co-maintainer

  • @SonvirChoudhary merci for the accept! – Pierre.Vriens Jan 18 '17 at 6:08
  • How to handle huge database database in forena ? My query returning total 5723 rows. How do i make query processing fats ? – Sonvir Choudhary Jan 18 '17 at 9:58
  • @SonvirChoudhary : that' a completely different question of course. to be honest I personally don't have an experience with "huge" databases (unless on a mainframe, where there is no Drupal). Why not post it as a different question? When you do, make sure to specify the format of your DB (Drupal, Oracle, MS SQL, MySQL, PDO etc), and also any type of "issues" you need to get resolved with such databases. NOTE: I seem to remember there is 1 issue in the Forena issue queue about some special option for processing huge amounts of data. – Pierre.Vriens Jan 18 '17 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.