add_image_size is scaling, even though crop is set to true

from your question i under that you want fixed size cropped images when you upload image, why don’t you use wp_get_image_editor. I used it in my project where i wanted cropped images of fixed size so i did this code.

$path = $newPath['basedir'].'/newImgas/';
$cropfile = uniqid() . '.png';
$cropfilename = $path.$cropfile;
$cropImage = home_url(). '/wp-content/uploads/newImgas/'.$cropfile;
$c_image = wp_get_image_editor($newImage);
if ( ! is_wp_error($c_image) ) {
  $c_image->resize( 600, 600, TRUE);
  $c_image->save( $cropfilename );
}

You can find example here. Please reply me if it isn’t what you wanted.

Leave a Comment