1

please visit link1 you can see image is zooming too much ,

but here link2 its fine. how to display link 1 image as like link2

code for link 1 :

<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getImage()); ?>

code for link 2 :

<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image')); ?>

why we are using code for link 1 is because to solve this problem

media.phtml

<?php
    $_product = $this->getProduct();
    $_helper = $this->helper('catalog/output');
    $dexxtz = Mage::helper('productzoom');

    $dexxtz->getCss();
    $dexxtz->getJs();
?>

<ul id="etalage">
    <li>                
        <img class="etalage_thumb_image" 
        src="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getImage()); ?>" />
        <img class="etalage_source_image" title="<?php echo $_product->getImageLabel(); ?>" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image'), true); ?>" />
    </li>
    <?php 
        foreach ($this->getGalleryImages() as $_image) {
            if(Mage::registry('current_product')->getImage() != $_image->getFile()) { ?>                
            <li>
                <img class="etalage_thumb_image" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile())); ?>" />
                <img class="etalage_source_image" title="<?php echo $_image->getLabel(); ?>" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()), true); ?>" />
            </li> 
        <?php 
            }    
        }
    ?>   
</ul>

script

var jQuery = jQuery.noConflict();
var b, c, w, h, t, l;

b = jQuery('.dexxtz-bg-modal');
c = jQuery('.dexxtz-modal-content');
w = (jQuery('body').innerWidth() / 2);
h = (window.innerHeight / 2);
t = ((h - (c.height() / 2)) < 15) ? '15px' : h - (c.height() / 2) + 'px';
l = ((w - (c.width() / 2)) > 0) ? w - (c.width() / 2) + 'px' : 0;

jQuery(window).resize(function() {
    w = (jQuery('body').innerWidth() / 2);
    h = (window.innerHeight / 2);
    t = ((h - (c.height() / 2)) < 15) ? '15px' : h - (c.height() / 2) + 'px';
    l = ((w - (c.width() / 2)) > 0) ? w - (c.width() / 2) + 'px' : 0;

    c.css('top', t)
    c.css('left', l);
});

function DexxtzModal() {            
    c.css('top', t)
    c.css('left', l);
    b.fadeIn('slow');
    c.fadeIn('slow');   
}

function DexxtzModalClose() {
    b.fadeOut('slow');
    c.fadeOut('slow');
}

we have same kind of configuration in both links.

7
  • You are fetching the product image directly from media folder so only it with full size. If you resize the image while fetching means your issue will be solved,
    – Manikandan
    Commented May 4, 2016 at 10:31
  • @Manikandan can you help me with the code ? Commented May 4, 2016 at 10:32
  • i have posted an answer related to it. It may help you i think so @Baby in Magento
    – Manikandan
    Commented May 4, 2016 at 10:35
  • 1
    @Baby in Magento link1is not working. shows 404 Commented May 9, 2016 at 12:44
  • @AshishMadankar Thanks buddy for informing, i will correct it soon. Commented May 9, 2016 at 12:47

1 Answer 1

4

You can used the following codes instead of link 1 code

$smallImageUrl = Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getSmallImage());

or

echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(350, 350);
10
  • when i tried your 1st code, i found blank page : <?php $smallImageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage()); ?> when i tried second code, zoom problem is fixed , but this problem will come Commented May 4, 2016 at 10:43
  • in the first code use '$_product' instead of $product @Baby in Magneto. What problem you are facing in second code
    – Manikandan
    Commented May 4, 2016 at 10:46
  • stil blank page for 1st code , please check : <?php $smallImageUrl = $_productMediaConfig->getMediaUrl($_product->getSmallImage()); ?> if i use 2nd code image will serve from cache path. but i want from main path Commented May 4, 2016 at 10:50
  • i have edited the answer check it now@Baby in Magento
    – Manikandan
    Commented May 4, 2016 at 10:52
  • i used 1st code, its displaying like this : prnt.sc/b03wie , only loading symbol displaying. Commented May 4, 2016 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.