<?php
$link_before = $after_link = $image = $thim_animation = $images_size = '';
$src         = wp_get_attachment_image_src( $instance['image'], $instance['image_size'] );

$thim_animation .= thim_getCSSAnimation( $instance['css_animation'] );

if ( $src ) {
	$images_size = @getimagesize( $src['0'] );
	$image       = '<img src ="' . $src['0'] . '" ' . $images_size['3'] . ' alt=""/>';
}
if ( $instance['image_link'] ) {
	$link_before = '<a href="' . esc_url($instance['image_link']) . '">';
	$after_link  = "</a>";
}
if ( $instance['image_stype'] == "style-title" ) {
	echo '<div class="single-image-title ' . $instance['image_alignment'] . $thim_animation . '">';
		echo '<div class="single-image">' . $link_before . $image . $after_link . '</div>';
		echo '<div class="single-content">';
			echo '<h3>'.esc_html( $instance['image_title']).'</h3>';
			echo '<div class="description">'.esc_html( $instance['image_description']).'</div>';
			echo '<a class="link" href="'.esc_url($instance['image_link']).'">'.esc_html( $instance['image_button']).'</a>';
		echo '</div>';
	echo '</div>';
} else {
	echo '<div class="single-image ' . $instance['image_alignment'] . $thim_animation . '">' . $link_before . $image . $after_link . '</div>';
}
