diff --git a/app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php b/app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php index 85f260f..03b8156 100644 --- a/app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php +++ b/app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php @@ -80,7 +80,7 @@ protected function _getValue(Varien_Object $row) $val = $val2 = $row->getData($this->getColumn()->getIndex()); $val = str_replace('no_selection', '', $val); $val2 = str_replace('no_selection', '', $val2); - $url = Mage::helper('enhancedgrid')->getImageUrl($val); + $url = Mage::helper('enhancedgrid')->getImageUrl($val, $row); if (!Mage::helper('enhancedgrid')->getFileExists($val)) { $dored = true; diff --git a/app/code/community/TBT/Enhancedgrid/Helper/Data.php b/app/code/community/TBT/Enhancedgrid/Helper/Data.php index 01a01e4..e5dbfe3 100644 --- a/app/code/community/TBT/Enhancedgrid/Helper/Data.php +++ b/app/code/community/TBT/Enhancedgrid/Helper/Data.php @@ -2,11 +2,23 @@ class TBT_Enhancedgrid_Helper_Data extends Mage_Core_Helper_Abstract { - public function getImageUrl($image_file) + /** + * Get url of cached thumbnail image + * Will generate cached image if doesn't exist + * + * @param string $image_file + * @param Mage_Catalog_Model_Product $product + * @return bool|string + */ + public function getImageUrl($image_file, $product) { $url = false; - $url = Mage::getBaseUrl('media').'catalog/product'.$image_file; - + if (!empty($image_file)) { + $helper = Mage::helper('catalog/image')->init($product, 'thumbnail'); + $width = Mage::getStoreConfig( 'enhancedgrid/images/width'); + $height = Mage::getStoreConfig( 'enhancedgrid/images/height'); + $url = $helper->resize($width, $height)->__toString(); + } return $url; }