The doc block for get_image_sizes_by_ratio() specifies that the method "Gets the first size defined for each dimension." This makes some sense if all sizes are cropped alike for a given aspect ratio, but it does mean that passing any declared image size other than the first in the image_ratio_map list causes an error because of these lines:
if ( empty( $_REQUEST['size'] ) || ! in_array( $_REQUEST['size'], $this->get_image_sizes_by_ratio() ) )
wp_die( sprintf( __( 'Invalid %s parameter.', 'wpcom-thumbnail-editor' ), '<code>size</code>' ) );
If this is expected behavior, the documentation should be improved to explain that regardless of the size in an aspect ratio that we want to edit, we have to pass the first declared image size in $this->image_ratio_map[$ratio].
If you should be able to pass another image size name that is present in $this->image_ratio_map[$ratio] other than $this->image_ratio_map[$ratio][0], then the get_image_sizes_by_ratio method should be amended to return a more comprehensive list, or else the $_REQUEST['size'] check should be changed to validate against the full list of supported names for a given ratio.
The doc block for
get_image_sizes_by_ratio()specifies that the method "Gets the first size defined for each dimension." This makes some sense if all sizes are cropped alike for a given aspect ratio, but it does mean that passing any declared image size other than the first in theimage_ratio_maplist causes an error because of these lines:If this is expected behavior, the documentation should be improved to explain that regardless of the size in an aspect ratio that we want to edit, we have to pass the first declared image size in
$this->image_ratio_map[$ratio].If you should be able to pass another image size name that is present in
$this->image_ratio_map[$ratio]other than$this->image_ratio_map[$ratio][0], then theget_image_sizes_by_ratiomethod should be amended to return a more comprehensive list, or else the$_REQUEST['size']check should be changed to validate against the full list of supported names for a given ratio.