webtintin Posted August 21, 2010 Share Posted August 21, 2010 Hi,if you really want a perfect image quality and dimensions on the featured products you have to change the file:images.inc.phpFor ex. I need images : 240 x 340 px so I have modified inside the images.inc.php :______________________________________________________________________________________________function imageResize($sourceFile, $destFile, $destWidth = NULL, $destHeight = NULL, $fileType = 'jpg'){ list($sourceWidth, $sourceHeight, $type, $attr) = getimagesize($sourceFile); if (!$sourceWidth) return false; if ($destWidth == NULL) $destWidth = $sourceWidth; if ($destHeight == NULL) $destHeight = $sourceHeight; $sourceImage = createSrcImage($type, $sourceFile); $widthDiff = $destWidth / $sourceWidth; $heightDiff = $destHeight / $sourceHeight; if ($widthDiff > 1 AND $heightDiff > 1) { $nextWidth = $sourceWidth; $nextHeight = $sourceHeight; } else { if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff)) { $nextHeight = 360; $nextWidth = 240; $destWidth = 240; } else { $nextWidth = 240; $nextHeight = 360; $destHeight = 360; } } /* $borderWidth = intval(($destWidth - $nextWidth) / 2); $borderHeight = intval(($destHeight - $nextHeight) / 2); */ $borderWidth = 1; $borderHeight = 1; $destImage = imagecreatetruecolor(240, 360); $white = imagecolorallocate($destImage, 255, 255, 255); imagefill($destImage, 0, 0, $white); imagecopyresampled($destImage, $sourceImage, $borderWidth, $borderHeight, 0, 0, $nextWidth, $nextHeight, $sourceWidth, $sourceHeight); imagecolortransparent($destImage, $white); return (returnDestImage($fileType, $destImage, $destFile));}______________________________________________________________________________________________In this way I can have a perfect image 240x360 px.So before import the images you have to be shure to create all the images at that resolution : 240x360 px.Thanks,Webtintin Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now