-1

I am building an application with fabrik and have a script that gets a base64 image code from an external source and then stores it in a database field. I would like to be able to display this image in fabrik lists on the frontend rather than displaying the base64 code. Has anyone done anything like this using fabirk in the past?

Sandra Willford
  • 3,459
  • 11
  • 49
  • 96
  • Please read [How to ask a good question](http://stackoverflow.com/help/how-to-ask) and [The perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and how to create a [Minimal, Complete and Verifiable Example (MVCE)](http://stackoverflow.com/help/mcve) to improve your question and chances to get an answer. – Douwe de Haan May 16 '17 at 14:27

1 Answers1

0

You can use a separate field that will take your base64 field and use it to construct an image tag when rendered in the list.

So let's say the data you want is in my_list___image. Create a separate field my_list___image_view of type calc.

In the calculation box, enter the following:

return '<img src="data:image/png;base64, {my_list___image}" alt="Alt text" />';

I'd also recommend adding a field for the image alt text. You also will have to take care of the image type. If they're all png or jpeg, that's fine otherwise you'll need to store or be able to derive that somehow.

Cody Hamilton
  • 331
  • 1
  • 4