Code for secondary images?

Is there a code I can use to plug in secondary images? I’d like to be able to do something like this…



if secondary image #1 exists… display here

if secondary image #2 exists… display here