<?php

use Tangibledesign\Framework\Models\Image;

/* @var Image|false $mhTempImage */
/* @var string $mhImageSize */
global $mhTempImage, $mhImageSize;

if ($mhTempImage) :
    $mhTempImageSrcset = $mhTempImage->getSrcset($mhImageSize);
    ?>
    <img
            class="lazyload"
            src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAQAAAA3fa6RAAAADklEQVR42mNkAANGCAUAACMAA2w/AMgAAAAASUVORK5CYII="
            alt="<?php echo esc_attr($mhTempImage->getAlt()); ?>"
        <?php if (!empty($mhTempImageSrcset)) : ?>
            data-srcset="<?php echo esc_attr($mhTempImageSrcset); ?>"
            data-sizes="auto"
        <?php else : ?>
            data-src="<?php echo esc_url($mhTempImage->getImageUrl($mhImageSize)); ?>"
        <?php endif; ?>
    >
<?php else : ?>
    <img
            src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAQAAAA3fa6RAAAADklEQVR42mNkAANGCAUAACMAA2w/AMgAAAAASUVORK5CYII="
            alt="placeholder"
    >

    <?php get_template_part('templates/partials/image_placeholder'); ?>
<?php endif;
