Display images/sprites from calculation field
AnsweredIs it possible to display an image or parts of a sprite using javascript with the calculation field? for example:
if ( @number > 1 ) { display image1 } else { display image 2 }
Thanks
Alex
-
I've got images loading which is great and I now would like to know if it's possible to either specify the image size so I can scale an image instead of having to create one a a specific size or ideally is there a way to view sections of a sprite (as one would normally do with css). I've had a play with some basic javascript but am having no joy.
Thanks
Alex -
Thanks Martijn, knowing that save me a lot of time.
Daniel, I found the image code has to be inside a set of single quotes, which evidently you've discovered.
so for example my code now looks like:
var red = '' var blue = '' var green = '' if (Pick a colour=="Red") red else if (Pick a colour=="Blue") blue else if (Pick a colour=="Green") green
-
Hi i'm wanting to retrieve an image in a calculation field, and then display that image.
I have seen it done elsewhere, and i was just wondering what i am doing wrong? My code seems to be fine and the field is taking in the calculation, but instead of returning an image it is returning a boolean value of 0 or 1.
Why is it doing this? For example my code is of follows:
if(Product Safety Status Type=="Type 3"){
var typeThree = ''
}If the field is equal to Type 3, i am just getting a result of '1'.
Any help would be much appreciated, thanks
-
Thanks everyone for the info above, this seems really helpful. Unfortunately when I follow the example:
var typeThree = '!(image url)'
if(Product Safety Status Type=="Type 3"){ typeThree }Podio throws up a preview below the calculation field saying - Invalid Value "myUrl" (string): must be a number
I'm not sure what I am missing (though this error does have multiple mentions in Podio's help centre that I am combing thru.
Thanks for any info.
-
Scratch the query above. I finally found the 'answer':
"cause your first try had a number as result Podio saved this calculation field as number type (click on the field settings and you see it's number type). You can't change this type later. So you have to create a new calculation field."
-
Hi Phil,
image fields are the only field type you don't have access to in a calculation field. So it's not possible to get them via a calculation. You would need the image URL to display the image in a calculation field. For that you need an extension like Globiflow or you have to use the API.
Rainer
-
Unfortunately not possible, cause the app view doesn't render markdown (and for displaying the image you use markdown syntax in the calculation field). The only workaround I can think of is to add an image field and let Globiflow extract the url from the calculation field and add it (with a WGET update action) to the image field (if you already have the url in another field you wouldn't need the calculation field anymore, Globiflow could get the url from the other field.
Rainer
-
Rainer Grabowski
How would you go about doing the globiflow part? I have the link somewhere else in the file but don't know the wget. This is the url link in the podio as a specific example.
Please sign in to leave a comment.
Comments
17 comments