
<?php if ($this->sources): ?>
  <picture>
    <!--[if IE 9]><video style="display: none;"><![endif]-->
    <?php foreach ($this->sources as $source): ?>
      <source srcset="<?php echo $source['srcset'] ?>"<?php if (!empty($source['sizes'])): ?> sizes="<?php echo $source['sizes']; ?>"<?php endif; ?><?php if (!empty($source['media'])): ?> media="<?php echo $source['media']; ?>"<?php endif; ?> />
    <?php endforeach; ?>
    <!--[if IE 9]></video><![endif]-->
<?php endif; ?>

<img src="<?php echo $this->img['src']; ?>"<?php if ($this->img['srcset'] !== $this->img['src']): ?> srcset="<?php echo $this->img['srcset']; ?>"<?php endif; ?><?php if (!empty($this->img['sizes'])): ?> sizes="<?php echo $this->img['sizes']; ?>"<?php elseif (!$this->sources): ?> width="<?php echo $this->img['width']; ?>" height="<?php echo $this->img['height']; ?>"<?php endif; ?> alt="<?php echo $this->alt; ?>"<?php if ($this->title): ?> title="<?php echo $this->title; ?>"<?php endif; ?> />

<?php if ($this->sources): ?>
  </picture>
<?php endif; ?>

<?php if ($this->sources || $this->img['src'] !== $this->img['srcset']): ?>
  <script type="text/javascript">
    /* <![CDATA[ */
    window.respimage && window.respimage({
      elements: [document.images[document.images.length - 1]]
    });
    /* ]]> */
  </script>
<?php endif; ?>
