mano_msk
mano_msk

Reputation: 51

How to remove loading product images from cache in magento?

Due to some problems product images in cache folder turned empty (file is there but empty).Magneto loads product images from cache folder only. For example: http://example.com/media/catalog/product/cache/54/small_image/295x295/9df78eab33525d08d6e5fb8d27136e95/b/r/br7462vi_1.png here br7462vi_1.png turned empty.(0 bytes).

but http://example.com/media/catalog/product/b/r/br7462vi_1.png works fine.

How can I stop magento loading product images from cache?

Upvotes: 0

Views: 8700

Answers (2)

Piyush Srivastava
Piyush Srivastava

Reputation: 94

Replace this from list.phtml and all your custome template where you want to load from main media folder

<img id="product-collection-image-<?php echo $_product->getId(); ?>"
                 src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(236,193); ?>"
                 alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

With This Code:

<img width="236" height="193" id="product-collection-image-<?php echo $_product->getId(); ?>"
                 src="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl( $_product->getSmallImage()); ?>"
                 alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

it only for grid mode you can change for list mode also and product details page medai.pthml file only change on this file src tag src="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl( $_product->getSmallImage()); ?>"

Reference: How to remove the cache url for product images in magento

Upvotes: 0

Makwana Ketan
Makwana Ketan

Reputation: 1388

No need to worry. Simply Login to admin panel.

Goto Admin ->System ->Cache management click on Flush Catalog Images Cache

And also flush all magento cache.

Now all image urls should work.

If you have still problem then just give 777 permission on media/catalog/product directory.

I hope it works.

Upvotes: 2

Related Questions