title: How to show an image conditionally in Thymeleaf?
body: <p>I have a controller that returns a <code>ReponseEntity&lt;byte[]&gt;</code> image and I can show it with the following tag:</p>
  
  <pre><code>&lt;img th:src="@{'./my-files/main-logo'}"
  </code></pre>
  
  <p>I can also show an image from the /img/ folder with this tag:</p>
  
  <pre><code>&lt;img th:src="@{/img/default-logo.png}"
  </code></pre>
  
  <p>I want to show the image from the database when it is present, and the image from the folder as a default if the ResponseEntity is null.</p>
  
  <p>I tried all kind of ternary conditions but none of them worked.
  Any suggestions?</p>