Force WordPress to resize to sizes larger than original an image when cropping

An snippet to force WordPress to upscale an image if necessary to fit dimensions provided in add_image_size() when cropping. It will fire both when uploading a new image and through a media regenerate call using wp-cli.

View the code on Gist.

Caveats: it needs lots of ram and a lot of storage.

Forther info in this answer by levi at Stack Overflow.