Post

3 followers Follow
0
Avatar

Images in calculation field not showing in PDF

I have a calculation field on Podio that is used within a PDF on Globiflow.

This calculation will sometimes contain an image. However, when it does the image is not showing up within the PDF.

I know that I have an alternative of using HTML detail tables, but this makes the text very small. Is there anyway work-around to get this image to display correctly? The code I am using to display the image within the calculation is:

var link1 = @Image Link
var image = "![](" + link1 + ")";

Where image link is a link field to the image stored on Podio.

Many thanks,

Jemma Tansley

Please sign in to leave a comment.

11 comments

0
Avatar

Hi Jemma,

Globiflow needs the original URL of the image to display it in the PDF. But your calculation field, which displays the image, doesn't give this URL to Globiflow (Globiflow can't recognize "![](" + link1 + ")" as a URL)  .  A workaround in Globiflow is: Add an action "Get referenced items" from the app where the field Image Link is in. Then a token [(Ref app) Image Link] is available. This token you can insert into the PDF builder. 

Rainer

Rainer Grabowski 0 votes
0
Avatar

Hi Rainer,

Unfortunately this is not a solution to my problem. This would be my way of using the field if I had only one related item to the app. However, I have used a calculation field to capture all of the data into one field so that I can bring across multiple records. It works perfectly if I don't have any images in the calculation, as soon as I do I come across the white box red cross. If I was to bring across the image alone through a reference, it would bring through the image without the relative information.

Do you have any other suggestions?  

Jemma Tansley 0 votes
0
Avatar

Hello Jemma,

as  I undestand  you have additional information (text) in your calculation field plus the image and you want both in the PDF - am I right?

Can you please add a screenshot of your calculation field and the url of an image?

Rainer

Rainer Grabowski 0 votes
0
Avatar

Rainer,

Yes that is correct. I need the information to pull through together so that you can see which images are related to which information.

Below you can see the summary of one of the items (this one in particular having an image).

The image link is gathered from this field:

Then each of these items are brought together into a bigger calculation (separated by lines) which is pulled through into the PDF.

Everything works great apart from the image. I hope these screenshots are useful!

Jemma Tansley 0 votes
1
Avatar

Hi Jemma,

how does the URL look like? I assume it's a Podio-File-URL - and this URL is not public. But Globiflow needs a public URL to display the image in the PDF. Globiflow provides a public URL token for the image field, but you have to get it in a flow.

Cause you are collecting multiple items in one calculation field I see only one possiblity. Create a single line text field in the item where the image field is in. And then 2 flows, one "when item created" and one "when item updated and field Image has changed", both with the action: update text with image public url.

Then in the calculation field use this field, not the link field: "![](" + @text field + ")". Maybe this text field would make the link field superfluous.

Rainer

 

Rainer Grabowski 1 vote
0
Avatar

Rainer,

Thank you very much for the suggestion! It works perfectly with one image.

Now I may be pushing the boat a bit here... but Is there a possibility to allow the flow to work with more than one image? Some items may have 2/3 images and of course the flow will add their public URLs to the text field, but they will be grouped together and only separated by commas. The calculation field will only treat them as one link.

I know I could create several image fields and hence several text fields, then treat them each individually, but I don't want to have to have that if necessary.

Any suggestions?

Many thanks,

Jemma Tansley 0 votes
0
Avatar

Hi Jemma,

did you add the text field for the public image url in each item? Please share a screenshot of the "bigger" calculation field (with your code) where you collect all items and a screenshot of the flow in Globiflow.

Rainer

Rainer Grabowski 0 votes
0
Avatar

Hi Rainer,

Yes I did. I may have worded myself incorrectly with my question there.

What I was meant to ask was the possibility of having more than one image for each item. If each item has one image then it comes through to the bigger calculation very well. The issue is when I have more than one the public url becomes the links of both images, separated with a comma.

Is this better explained?

Many thanks,

Jemma Tansley 0 votes
1
Avatar

Ok, I understand now. Yes, it's possible. The basic code for this would be:

imageURLs = @All of text field with urls.toString().split(",")
var imageLinks = [];
for(var i = 0;i < imageURLs.length;i++){
imageLinks.push("![](" + imageURLs[i] + ")");
};
imageLinks.join("\n\n")

But  I assume you compose the content of the calculation field with something like:

var des = @all of description;
var sum = @all of summary;
var text = @all of text field; 

Then you have to do: 

var display = [];
for(var j = 0; j < text.length;j++){
var imageLinks = [];
var imageURLs = text[j].split(",")
for(var i = 0;i < imageURLs.length;i++){
imageLinks.push("![](" + imageURLs[i] + ")");
};
var image = imageLinks.join("\n\n");
display.push(des[j] + "\n" + sum[j] + "\n " + imageLinks.join("\n"));
};
display.join("\n").replace(/XXX/g,"")

 For this code it is very important, that the text field for the public url never is empty! So in Globiflow you have to add:

var publicURL = [(item) public image url(s)]
var publicURL = [(variable) publicURL] == "" ? "XXX" :  [(variable) publicURL]
update text field = calc:  [(variable) publicURL]

It's not sure that this code really fits to your setup. So if there are problems, please share a screenshot of the code. 

Rainer
rg@delos-consulting.com

Rainer Grabowski 1 vote
0
Avatar

Hi Rainer,

Sorry for the late reply, I have been offline these past few days. 

I will be looking into your suggestion within the next couple of days. I tried to have a look this morning but I seem to be having some problems with globiflow as it is not pulling through all the information it was previously. 

I will get back to you as soon as I can with an update.

 

Many thanks,

Jemma Tansley 0 votes
0
Avatar

Hi Rainer,

I have done some testing and it seems that it works very well just by splitting the combined public URL string, adding each item to the array and then displaying, just as you have shown in the first block of code. If I do this in a calculation field, and reference into the main calculation, it works very well. 

Thank you very much for your help! :-)

Jemma Tansley 0 votes