Jump to content

Remowe White space around image


Recommended Posts

I solved, remove white space with force script to resize images by image's original ratio, at admin/function.php this remove white space around image.

admin/functions.php around line 203

	if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff))
	{
		$nextHeight = $destHeight;
		$nextWidth = intval(($sourceWidth * $nextHeight) / $sourceHeight);
		$destWidth = intval(($sourceWidth * $nextHeight) / $sourceHeight); //force the destination width to original ratio
		//$destWidth = (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 ? $destWidth : $nextWidth);
	}
	else
	{
		$nextWidth = $destWidth;
		//$nextHeight = intval($sourceHeight * $destWidth / $sourceWidth);
		$nextHeight = $sourceHeight * ($destWidth / $sourceWidth);
		$destHeight = $sourceHeight * ($destWidth / $sourceWidth); //force the destination heighth to original ratio
		//$destHeight = (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 ? $destHeight : $nextHeight);
	}
}

this solution works for me

Link to comment
Share on other sites

  • 4 years later...
  • 2 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...