If else conditions in tap_action on lovelace picture element card

Using the script is the best way. Otherwise you have to use this: