title: Magento2: get relative path for image
body: <p>What I want to do is check in my template file (list.phtml, the product list), if an image exists or not. I can output an existing image like that: </p>
  
  <pre><code>&lt;img src="&lt;?php echo $block-&gt;getViewFileUrl('Images/imagename.png'); ?&gt;" alt=""&gt;
  </code></pre>
  
  <p>My problem is: before showing that I want to check if that image exists. But of course file_exists only takes a relative path and I cannot find out how to get a relative path for my image. Is that possible in magento2 and if so - how? </p>