Conditional badge at all possible?

I have a picture-elements card with multiple state badges on top of it.
I want to make them conditional and I figured with the solution that @Troon posted this would be possible. But I can’t get it to work. Is this solution also possible for a picture-elements card ?