Jump to content

Product image resize // top align without white bar


Recommended Posts

Some of my images have not a 1:1 aspect ratio and a white bar is generated to fill up the space. In some cases I would need the alignment to be top, not center. The code that has to be changed is most likely in the file classes/ImageManager.php, but I am not skilled enough to make the adjustment myself. If anyone could help me with the modification, it would be much appreciated.

post-526847-0-29209800-1365524231_thumb.jpg

Edited by JanaNovakova (see edit history)
Link to comment
Share on other sites

  • 6 months later...

I don't know if you still need an answer but here it is:

 

Yes, you have to edit class/ImageManager. Find the function public static function resize, and replace the line

 

imagecopyresampled($dest_image, $src_image, (int)(($dst_width - $next_width) / 2), (int)(($dst_height - $next_height) / 2), 0, 0, $next_wid    th, $next_height, $src_width, $src_height);
 
with 
 
imagecopyresampled($dest_image, $src_image, (int)(($dst_width - $next_width) / 2), 0, 0, 0, $next_width, $next_height, $src_width, $src_hei    ght);
 
(Instead of "(int)(($dst_height - $next_height) / 2)" a 0.)
 
Link to comment
Share on other sites

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...