How to get full product image url in Magento

后端 未结 4 1679
攒了一身酷
攒了一身酷 2021-02-08 19:01

How to get full product image url in magento ,i need to migrate the data from magento to django so i need to get the product full imag

相关标签:
4条回答
  • 2021-02-08 19:31

    You can try below code first of all call helper of catalog

    echo  Mage::helper('catalog/image')->init($product, 'thumbnail');
    

    From this code you can get cache path also.

    0 讨论(0)
  • 2021-02-08 19:31

    Try this

    $product = Mage::getModel('catalog/product')->load($product_id);
    $full_path_url = Mage::helper('catalog/image')->init($product, 'thumbnail');
    
    0 讨论(0)
  • 2021-02-08 19:48

    After you loaded your product using load() you can use the following in your code:

    Full size image:

    $imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage();
    

    Resized/Cached image:

    $imageCacheUrl = Mage::helper('catalog/image')->init($product, 'image')->resize(135, 135);
    

    If you need a different cache size, then use other numbers for the resize method.

    0 讨论(0)
  • 2021-02-08 19:48
       <img src="<?php echo Mage::helper('catalog/image')->init($_products, 'small_image')->resize(200,200);?>" width="200" alt=""> 
    
        <?php ini_set('display_errors','on');
        require_once 'app/Mage.php';
        Mage::app('default');
        $_products = Mage::getResourceModel('catalog/product_collection')->toOptionArray();
        $product_id = $this->getRequest()->getParam('id');
        $_products=Mage::getModel('catalog/product')->load($product_id);?>
    
    0 讨论(0)
提交回复
热议问题