How to stop Opencart from cropping product images with auto height


In FPT file the following file in your Opencart install and download it


Make a copy of it and call it image-backup.php – This is so you have a backup of the original in case you ever have any problems.

[banners_zone id=2]

Find this code:

$scale_h = $height / $this->info[‘height’];

and replace it with this:

$scale_h = ($height == 1 ? $scale_w : $height / $this->info[‘height’]);
$height = $this->info[‘height’] * $scale_h;

Now upload both files back on to your server

Now go into your Opencart admin, go to system > settings > and click the pencil icon next to your store name.  Now click on images.

Where you want the height to be auto… add a “1”. This ONLY works for the height.


You must also do this for your featured images in the featured module. 



Translate »