What method can remove proportions for image generation?

For example, I added a custom size for the image.

add_image_size('224_269', 224, 269, false); 

I need the images to be generated with exactly this width and height, as specified here, but when I generate images, their size is 224x173, etc.

  • I do not recommend setting the picture size as a name. Better when it displays the purpose of the picture format. - tutankhamun
  • Thanks, I just gave an example :) - Mozz

1 answer 1

Set the last parameter to true . He is responsible for cropping the image (relative to its center). Also, this parameter allows you to specify the position of the trim.

Reference to documentation (in English)

Translation of the description (in Russian)

Updated

Rummaged in the source. To save pictures with altered proportions, you will have to either re-save them or write the image_resize_dimensions filter. There will be problems with the filter. It will be necessary to determine when exactly the right size is being re-stored.

  • Thanks for the answer, but I need not to crop the picture, but simply to make a resize for a given width and height of the picture - Mozz
  • @Mozz Loss of proportions? - tutankhamun
  • I need the picture to be the size I set in the function, without proportion - yes - Mozz