Guest User

media

a guest
Jan 8th, 2015
310
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Academic Free License (AFL 3.0)
  8. * that is bundled with this package in the file LICENSE_AFL.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/afl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magentocommerce.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magentocommerce.com for more information.
  20. *
  21. * @category design
  22. * @package base_default
  23. * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
  24. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
  25. */
  26.  
  27. /**
  28. * Product media data template
  29. *
  30. * @see Mage_Catalog_Block_Product_View_Media
  31. */
  32. ?>
  33. <?php
  34. $_product = $this->getProduct();
  35. $_helper = $this->helper('catalog/output');
  36. $setting = Mage::helper('em0113settings');
  37. $viewmode = $setting->getImageProduct_Viewmode();
  38. ?>
  39. <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
  40. <?php if ($viewmode == 'cloudzoom'): ?>
  41. <p class="product-image">
  42. <?php
  43. $_img = $this->helper('catalog/image')->init($_product, 'image');
  44. $_img2 = clone $_img;
  45. $config = "zoomWidth: ".min($setting->getImageProduct_CloudZoomWidth(390), $_img->getOriginalWidth()).",";
  46. $config .= "zoomHeight: ".min($setting->getImageProduct_CloudZoomHeight(390), $_img->getOriginalHeight()).",";
  47. $config .= 'adjustX: 10, adjustY:-4';
  48. if($_img->getOriginalWidth() >= 390)
  49. $w = $setting->getImageProduct_BaseImageWidth(390);
  50. else
  51. $w = $_img->getOriginalWidth();
  52. $ratio = $w / $_img->getOriginalWidth();
  53. //$h = $ratio * $_img->getOriginalHeight();
  54. $h = $setting->getImageProduct_BaseImageHeight(390);
  55. ?>
  56. <a class="cloud-zoom" id="image_zoom" rel="<?php echo $config ?>" href="<?php echo $_img ?>" >
  57. <img itemprop="image" src="<?php echo $_img->resize($w, $h); ?>" alt='' title="<?php echo $this->escapeHtml($this->getImageLabel());?>" />
  58. </a>
  59. <a id="zoom-btn" rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>" title="<?php echo $this->escapeHtml($this->getImageLabel());?>">Zoom</a>
  60. </p>
  61. <?php elseif ($viewmode == 'lightbox'): ?>
  62. <p class="product-image">
  63. <a rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" title="<?php echo $this->escapeHtml($this->getImageLabel())?>">
  64. <?php
  65. $w = $setting->getImageProduct_BaseImageWidth(390);
  66. $h = $setting->getImageProduct_BaseImageHeight(390) ? $setting->getImageProduct_BaseImageHeight(390) : null;
  67. $_img = '<img id="image" itemprop="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize($w, $h).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
  68. echo $_helper->productAttribute($_product, $_img, 'image');
  69. ?>
  70. </a>
  71. </p>
  72. <?php else: ?>
  73. <p class="product-image product-image-zoom" style="width:<?php echo $setting->getImageProduct_BaseImageWidth(390) ?>px;height:<?php echo $setting->getImageProduct_BaseImageHeight(390) ?>px; overflow:hidden;">
  74. <?php
  75. $_img = '<img style="max-width:none;" id="image" itemprop="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
  76. echo $_helper->productAttribute($_product, $_img, 'image');
  77. ?>
  78. </p>
  79. <p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
  80. <div class="zoom" style="width:<?php echo $setting->getImageProduct_BaseImageWidth(390) ?>px;">
  81. <img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
  82. <div id="track">
  83. <div id="handle"></div>
  84. </div>
  85. <img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
  86. </div>
  87. <script type="text/javascript">
  88. //<![CDATA[
  89. Event.observe(window, 'load', function() {
  90. product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
  91. });
  92. //]]>
  93. </script>
  94. <?php endif ?>
  95. <?php else: ?>
  96. <p class="product-image">
  97. <?php
  98. $_img = '<img itemprop="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(
  99. $setting->getImageProduct_BaseImageWidth(390),
  100. $setting->getImageProduct_BaseImageHeight(390)).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
  101. echo $_helper->productAttribute($_product, $_img, 'image');
  102. ?>
  103. </p>
  104. <?php endif; ?>
  105. <?php if (count($this->getGalleryImages()) > 0): ?>
  106. <?php $limitmore = count($this->getGalleryImages()); ?>
  107. <div class="more-views slideshow-more-views">
  108. <span><?php echo $this->__('More View') ?></span>
  109. <ul>
  110. <?php foreach ($this->getGalleryImages() as $_image): ?>
  111. <li class="item" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px">
  112. <?php
  113. $_img = $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile());
  114. ?>
  115. <?php if ($viewmode == 'cloudzoom'): ?>
  116. <?php
  117. $_img_thumb = (string)$_img->resize(null);
  118. if($_img->getOriginalWidth() >= 390)
  119. $mv_w = $setting->getImageProduct_BaseImageWidth(390);
  120. else
  121. $mv_w = $_img->getOriginalWidth();
  122. $ratio = $mv_w / $_img->getOriginalWidth();
  123. $mv_h = $ratio * $_img->getOriginalHeight();
  124. $_img_thumb = (string)$_img->resize($setting->getImageProduct_ThumbBaseWidth(80), $setting->getImageProduct_ThumbBaseHeight(80));
  125. $_img_small = (string)$this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize($mv_w,$mv_h);
  126. $_img_big = (string)$this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile());
  127. ?>
  128. <a class="cloud-zoom-gallery" rel="
  129. useZoom:'image_zoom',
  130. smallImage:'<?php echo $_img_small ?>',
  131. adjustX:5, adjustY:-5" onclick="return false" href="<?php echo $_img_big ?>"><img
  132. src="<?php echo $_img_thumb ?>"
  133. alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px" />
  134. </a>
  135. <a class="no-display" href="<?php echo $_img_big ?>" rel="lightbox[em_lightbox]">lightbox moreview</a>
  136. <?php elseif ($viewmode == 'lightbox'): ?>
  137. <?php $_img_thumb = (string)$_img->resize($setting->getImageProduct_ThumbBaseWidth(80), $setting->getImageProduct_ThumbBaseHeight(80)); ?>
  138. <a rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile()); ?>" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>">
  139. <img src="<?php echo $_img_thumb; ?>" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px" />
  140. </a>
  141. <?php else: ?>
  142. <?php $_img_thumb = (string)$_img->resize($setting->getImageProduct_ThumbBaseWidth(80), $setting->getImageProduct_ThumbBaseHeight(80)); ?>
  143. <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>"><img
  144. src="<?php echo $_img_thumb; ?>"
  145. alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px" /></a>
  146. <?php endif ?>
  147. </li>
  148. <?php endforeach; ?>
  149. </ul>
  150. </div>
  151. <script type="text/javascript">
  152. jQuery(window).load(function() {
  153. jQuery('.slideshow-more-views ul').addClass('slides');
  154. jQuery('.slideshow-more-views').csslider({
  155. move : 1,
  156. circular : 0,
  157. direction : 'horizontal',
  158. parentHidden : '.product-img-box'
  159. });
  160. });
  161. jQuery('.cloud-zoom-gallery').click(function () {
  162. jQuery('#zoom-btn').attr('href', this.href);
  163. });
  164. </script>
  165. <?php endif; ?>
RAW Paste Data