Display images/sprites from calculation field

Answered

Comments

17 comments

  • Martijn Snels

    It's quite simple. Podio supports Markdown.

    ![Image Alt](https://dgyqr055mfays.cloudfront.net/site/images/home/work-everywhere.png)
    
    0
    Comment actions Permalink
  • Alex White

    Great, Thanks.

    0
    Comment actions Permalink
  • Alex White

    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

    0
    Comment actions Permalink
  • Martijn Snels

    Hi Alex, that's something which you'll have to do up front on the image itself. Podio places the image in the actual size.

    0
    Comment actions Permalink
  • Daniel Cid

    I am trying to do the same thing, but it is not working for me. Could you show your example code?

    I am using the following in the calculation field:

    if (% Total Score < 50) {
    Image Alt
    }
    else
    {"XXXX"}

    BUT it says Script syntax error...

    0
    Comment actions Permalink
  • Daniel Cid

    got it! thanks

    0
    Comment actions Permalink
  • Alex White

    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 = '![Red Image](http://www.clker.com/cliparts/9/1/5/2/119498475589498995button-red_benji_park_01.svg.thumb.png "Red")'
    
    var blue = '![Blue Image](http://www.clker.com/cliparts/a/9/3/e/1194984754884631372button-blue_benji_park_01.svg.thumb.png "Blue")'
    
    var green = '![Green Image](http://www.clker.com/cliparts/2/9/b/8/1194984775760075334button-green_benji_park_01.svg.thumb.png "Green")'
    
    if (Pick a colour=="Red") red 
    else if (Pick a colour=="Blue") blue
    else if (Pick a colour=="Green") green
    
    -1
    Comment actions Permalink
  • Jemma Tansley

    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 = 'Type 3 Image'
    }

    If the field is equal to Type 3, i am just getting a result of '1'.

    Any help would be much appreciated, thanks

    0
    Comment actions Permalink
  • Alex White

    it looks like you are assigning the variable, but not returning it. Assign the variable outside of the 'if' and then call it as the true value.

    i.e.

    var typeThree = '!(image url)'
    if(Product Safety Status Type=="Type 3"){ typeThree }

    0
    Comment actions Permalink
  • Brady Meisenhelder

    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.

    0
    Comment actions Permalink
  • Brady Meisenhelder

    Scratch the query above. I finally found the 'answer':

    https://help.podio.com/hc/communities/public/questions/203407537-IF-Command-with-Category?locale=en-us

    "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."

    0
    Comment actions Permalink
  • Phil Warth

    How do I get an image (or multiple images) from one app to appear in another app?
    What sort of calculation is required to make this happen?

    0
    Comment actions Permalink
  • Rainer Grabowski

    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 

    0
    Comment actions Permalink
  • Mike Cox

    Is there any way to have the image appear in the layout options so you can see it from the app preview.  Not having to go inside each item.  We're trying to have an image of the property on the Badge layout view.

    0
    Comment actions Permalink
  • Rainer Grabowski

    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

    0
    Comment actions Permalink
  • Mike Cox

    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.

    https://cdn.oncarrot.com/uploads/sites/4784/2018/07/40N.jpg

    0
    Comment actions Permalink
  • Mike Cox

    Nevermind I figured it out.  I just use the url as the wget.  THANKS!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk