If I understand the question correctly, you want to generate
test.jpg
test-150x150.jpg
instead of just:
test.jpg
when you upload an image called test.jpg
, of size 150×150, the same as the thumbnail size. (I used the 150×150 size here instead of your 300×200 to avoid confusing it with the medium size)
This restriction is implemented in the multi_resize()
method of the image editor classes, like WP_Image_Editor_Imagick
and WP_Image_Editor_GD
that extend WP_Image_Editor
:
$duplicate = ( ( $orig_size['width'] == $size_data['width'] )
&& ( $orig_size['height'] == $size_data['height'] ) );
If the size is the same as the size of the original image, then it’s not generated.
A possible workaround could be to extend the image class to your needs and add it to the list of available image editors through the wp_image_editors
filter.
Alternatively you could try to hook into the wp_generate_attachment_metadata
to generate the missing duplicate with a help from the image editor, like the save()
method.