1

I have a number of custom image sizes. I noticed earlier, when I was publishing a new post, that the post image was cropped AND scaled. It is exactly the right dimensions.. but it isn't the portion of the image it should be.

This is the code in functions.php, for this particular image size. add_image_size( 'post', 800, 350, array( 'left', 'top' ) );

Take a look at the original size:

http://cppcooper.com/wp-content/uploads/2016/03/ThreadExtraction.png

Now look at the "hard cropped" version:

http://cppcooper.com/wp-content/uploads/2016/03/ThreadExtraction-800x350.png

It is practically the same image, only scaled..

4

They are not the same. In the 800x350 image, a little bottom is cropped.

This is how the hard cropped work:

First, it scales your image to match your image size. It can be width or height. Your size is 800x350

  • If your original image scaled according to 800px width has the 400px height (bigger than 350), 50px of the bottom will be cropped ( because you choose 'top').
  • But if your original image scaled according to 800px width has the 300px height (smaller than 350), it will be scaled according to the height. Then the scaled version has the height is 350px and the width will be 933px, so 133px of the right will be cropped out because you choose 'left'.

Feel free to comment if you don't get my poor explain.

| improve this answer | |
  • Okay now that I understand how it works, I can at least attempt to manipulate it to be the result I want. – Josh C Mar 25 '16 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.