Show element if true, dynamic page

I have a dynamic page that displays information from a selected database.
I have now come to this that I would like to show a specific image only on a few pages from the database. On the ones that don’t have this image I don’t want to show anything.

I guess that I should work with a collapsed element and have a boolean decide if it should be shown or not?

How could I do this, I don’t any prior experience with boolean.

Thanks in advance!