有誰知道如何禁用產品圖像放大Magento?Magento如何禁用圖像縮放
6
A
回答
6
您可以在模板目錄(/ app/design/default/your_theme/template)中修改/catalog/product/view/media.phtml。這是將圖像輸出的代碼:
<?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
<p class="product-image product-image-zoom">
<?php
$_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
?>
</p>
<p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
<div class="zoom">
<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" />
<div id="track">
<div id="handle"></div>
</div>
<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" />
</div>
<script type="text/javascript">
//<![CDATA[
Event.observe(window, 'load', function() {
product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
});
//]]>
</script>
<?php else: ?>
<p class="product-image">
<?php
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
?>
</p>
<?php endif; ?>
第一部分(if子句後)輸出該可縮放圖像,而「else」部分輸出非變焦版本。我認爲,最簡單的解決辦法是擺脫if語句和剛剛離開的非縮放版本:
<?php
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
?>
作品就像在一個全新安裝的Magento的魅力。
2
如果您的圖像比較低,禁用變焦效果很好。對於高清imagaes嘗試使用此插件,這裏是一個例子:http://www.ajax-zoom.com/demo/magento/index.php/chair.html
相關問題
- 1. 如何在cms中縮放圖像Magento
- 2. 禁用圖像縮放時的滾動
- 3. 通過javascript禁用Firefox圖像縮放
- 4. Magento水印僅在縮放圖像中
- 5. JSP如何縮放圖像?
- 6. 如何縮放圖像?
- 7. 如何使用縮放縮放封面流圖像放大android
- 8. 如何用css縮放圖像
- 9. 如何使用JScrollBar縮放圖像?
- 10. 如何使用php縮放圖像
- 11. 如何使用CABasicanimation縮放圖像
- 12. 如何使用getScaledImage縮放圖像?
- 13. 如何使用tcpdf縮放圖像?
- 14. 如何啓用縮放圖像切換器中的縮放?
- 15. 縮放圖像
- 16. 圖像縮放
- 17. 如何在iPhone中縮放圖像而不縮放子視圖?
- 18. 爲圖像縮放圖像
- 19. 如何禁用Twitter Bootstrap中的縮小/縮小圖像?
- 20. JFreeChart禁用縮放
- 21. three.js:PerspectiveCamera:禁用縮放
- 22. JMapViewer禁用縮放
- 23. gmaps4rails禁用縮放
- 24. panningEnabled:false禁用縮放
- 25. Android:ImageView禁用縮放
- 26. 禁用縮放WebView?
- 27. 使用jquery縮放圖像
- 28. 使用CSS縮放圖像
- 29. CKEditor - 禁用圖像拖放
- 30. Android 4.1+(Javascript瀏覽器):如何禁用旋轉縮放/縮放?
謝謝你這個 – mcgrailm 2010-08-15 13:56:08