Problem displaying snapshot image of doorbell press on a card

I have an automation in which a camera takes a snapshot of everyone who presses the doorbell. The snapshots are saved in a sequential order snap0, snap1, snap2 etc. up to a maximum of 9 snapshots. After the 9th snapshot, the newer snapshots start overwriting the previous snapshots and the cycle continues. For this I am using a number helper. The notifications are send to my phone with the image of the snapshot. All this is working as intended.

I want to create a picture card in which the most current snapshot is displayed on the dashboard. The problem I am facing is that the file name is dynamically generated because of the number sequence and if I try to add the image path of the picture entity, the snapshot image does not appear.

/local/tmp/snap{{ states(‘input_number.snapshot_numbers’) | int }}.jpg

But if I specify the exact file name, I can see the image.
/local/tmp/snap0.jpg

Can someone please suggest how to get this to work. The dynamically generated images work well with the phone notification. For reference, the mobile phone notification action code is below:

service: notify.mobile_app_my_phone
data:
  message: Doorbell just rang at {{ now().strftime('%I:%M %p') }} "
  title: Doorbell
  data:
    image: >-
      https://myurl/local/tmp/snap{{states('input_number.snapshot_numbers') | int }}.jpg