Place the picture-xxx card inside a "custom:config-template-card" (CTC).
Declare a variable in CTC: "varMyUrl: some_expression".
Use this variable for an image’s URL - or that "some_expression" itself.
Now regarding that “some_expression”.
CTC uses JS, not jinjia.
So you need to rebuild your template according to JS syntax.
The easiest way is - create a template sensor to keep the URL as per your template, then use this sensor in CTC: "varMyUrl: states['sensor_my_url'].state".