# yaymail/4.4.5/templates/elements/image.php

YayMail – WooCommerce Email Customizer, version 4.4.5. 41 lines.

- Page: https://pluginprobe.com/plugins/yaymail/4.4.5/code/templates/elements/image.php
- Raw: https://pluginprobe.com/plugins/yaymail/4.4.5/raw/templates/elements/image.php
- Modified: 2026-04-23T12:04:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yaymail/4.4.5/code/templates/elements/image.php#L10-L20`.

```php
<?php
defined( 'ABSPATH' ) || exit;
use YayMail\Utils\TemplateHelpers;

/**
 * $args includes
 * $element
 * $render_data
 * $is_nested
 */
if ( empty( $args['element'] ) ) {
    return;
}

$element = $args['element'];
$data    = $element['data'];

$src = ! empty( $data['src'] ) ? $data['src'] : YAYMAIL_PLUGIN_URL . 'assets/images/woocommerce-logo.png';
// set fallback

$wrapper_style = TemplateHelpers::get_style(
    [
        'word-break'       => 'break-word',
        'text-align'       => $data['align'],
        'background-color' => $data['background_color'],
        'padding'          => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
    ]
);

ob_start();
?>

    <a href="<?php echo esc_url( do_shortcode( $data['url'] ) ); ?>" target="_blank" rel="noreferrer">
        <?php $image_width = isset( $data['full_width'] ) && filter_var( $data['full_width'], FILTER_VALIDATE_BOOLEAN ) ? '100%' : esc_attr( TemplateHelpers::get_dimension_value( $data['width'] ) ); ?>
        <img alt="<?php echo esc_attr( $data['alt'] ?? '' ); ?>" src="<?php echo esc_url( $src ); ?>" style="max-width: 100%; width: <?php echo esc_attr( $image_width ); ?>;" alt="YayMail Image" />
    </a>
<?php
$element_content = ob_get_clean();

TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );

```
