Distorted "hover" images in "Most Popular in Store" – JMProducts list mode home page

It’s the same problem as in this thread.

Add code in:
/app/design/frontend/default/jm_summer/template/joomlart/jmproducts/list.phtml after line 100.


        // create folder for resized images, maybe we need other sizes for tablet or mobile or change in basetheme
	$folderName = "./media/jmbasetheme/hover/resized/". $productlistimagewidth. "x". $productlistimageheight;
	        mkdir ($folderName, 0777, true);
	// changing image Url into direct path
	$dirImg = Mage::getBaseDir().str_replace("/",DS,strstr($hoverimage,'/media'));
	// get image name
	$imageName = substr(strrchr($hoverimage,"/"),1);
	// resized image path ($folderName/IMAGE_NAME) 
	$imageResized = Mage::getBaseDir('media').DS."jmbasetheme".DS."hover".DS."resized".DS.$productlistimagewidth. "x". $productlistimageheight.DS.$imageName; 
	// if resized image doesn't exist, create it and save the resized image to the resized directory 
	if (!file_exists($imageResized)&&file_exists($dirImg)) : 
		$imageObj = new Varien_Image($dirImg); 
	// get resized image Url
	$hoverimage = Mage::getBaseUrl('media')."jmbasetheme/hover/resized/".$productlistimagewidth. "x". $productlistimageheight. "/".$imageName;

Attention: The other display modes of JMProducts extension in JM_Summer are not prepared for "hover" images.

1 answer

Please login or Register to Submit Answer

Written By