<?php
/**
 * Single Product Image
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.14
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

wp_enqueue_style('cloud-zoom');
wp_enqueue_script('cloud-zoom');

global $post, $woocommerce, $product;
$attachment_ids = $product->get_gallery_attachment_ids();
$attachment_count   = count( $attachment_ids );

?>
<div class="product-img-box">
	<div class="row">
		<?php if ( $attachment_count > 1 ) { ?>
			<div class="span1">
				<?php do_action( 'woocommerce_product_thumbnails' ); ?>
			</div>
		<?php } //endif; ?>

		<div class="span4">
		<?php
			if ( has_post_thumbnail() || $attachment_ids ) {

				$image_id = has_post_thumbnail() ? get_post_thumbnail_id() : $attachment_ids[0];
				$image_title 		= esc_attr( get_the_title( $image_id ) );
				$image_link  		= wp_get_attachment_url( $image_id );

				$mainImageWidth = etheme_get_option('product_page_image_width');
				$mainImageHeight = etheme_get_option('product_page_image_height');
				$mainImageCrop = false;

				$image = '<img alt="" src="'. wp_get_attachment_url($image_id) .'" />';

				if ( $attachment_count > 1 ) {
					$gallery = '[product-gallery]';
				} else {
					$gallery = '';
				}

				echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<div class="product-image"><a class="cloud-zoom" href="%s" id="zoom1" data-rel="position: \'right\', adjustX: 10, adjustY: 0" title="%s">%s</a></div>', $image_link, $image_title, $image ), $post->ID );

			} else {

				echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="Placeholder" />', woocommerce_placeholder_img_src() ), $post->ID );

			}
		?>
		</div>

	</div>
</div>
