cancel
Showing results for 
Search instead for 
Did you mean: 

Proportionately crop product image on upload?

Proportionately crop product image on upload?

Hi there,

It's been awhile since I was working with Magento. Not sure how much has changed in the last year.  I'm trying to find out if there's a way to set product image upload to crop images to fill the set dimensions for the catalog by the theme.  For instance, if I have an image that's 600 x 400 px, but my catalog display wants images that are 200 x 300, I don't want there to be bars at the top and bottom. I just want the image resized to the correct height, then cropped for the width. Then on the product page itself, the full image can be seen when clicking on the initial display. Am I making any sense?

 

This is easy to do in WordPress and WooCommerce. But it appears to be a fairly complex thing to do with Magento.

 

Help?

 

Thanks in advance.

 

~Laura

3 REPLIES 3

Re: Proportionately crop product image on upload?

Magento uploads the exact image that you upload. It then crops it depending on the size requested in the template files and caches that cropped image. It will then use the cached images for that size.

 

So if you want to change the sizes of the images on pages (category page, product detail page) you can edit that in the template file. For the product it is [theme directory]/template/catalog/product/media.phtml

Kimberely Thomas
Magento Certified Solution Specialist
Business Solutions Architect
Magento, Expert Consulting Group
@magentogirl

Re: Proportionately crop product image on upload?

I'm sorry. I must not be explaining this correctly.  When I upload an image in landscape orientation, for instance, but my catalog image is square or portrait orientation, I don't want Magento to add bars at the top/bottom or on the left/right. I want the image to be proportionately sized to fill the whole dimensions requested, but cropping wherever necessary for that thumbnail.

 

In other words, if my category image is set to be 250x250 and the image I'm uploading is 400 x 600, I don't want the whole image shrunk to fit into the 250x250 space and create bars on the left/right to fill in the rest of the space.  I want it sized first to the desired width (or height depending on the calculations for that image), and whatever part of the image extends beyond the top and bottom just gets cropped off. Does this make sense?  It used to be done with TimThumb, I think, but that system doesn't appear to be used much anymore.

 

In WordPress what I'm looking for is called a hard crop. What Magento seems to do is a version of soft crop, but adding bars where necessary in order to fill the space the theme has asked for.

 

Here's an example of what I mean:

 

http://www.davidtan.org/wordpress-hard-crop-vs-soft-crop-difference-comparison-example/

 

Additionally, once on the individual product page, when that image is clicked on to enlarge, it should be the uncropped version of the image that the customer gets shown in the popup.

Re: Proportionately crop product image on upload?

The Million Dollar question

I feel you man Robot Sad