You can try this (not tested):
// Add image sizes for book outside
add_image_size( 'book_portrait_thumbnail', '150', '215', true );
add_image_size( 'book_portrait_square', '300', '300', true );
// Delete all intermediate image sizes
add_filter( 'intermediate_image_sizes', 'custom_image_sizes', 99 );
function custom_image_sizes( $image_sizes ) {
//In case of book return book sizes array
if( isset($_REQUEST['post_id']) && 'books' === get_post_type( $_REQUEST['post_id'] ) ){
return array( 'book_portrait_thumbnail', 'book_portrait_square' );
}
// Otherwise the other ones
return $image_sizes;
}
Of course, this is for science sake. Like others suggested I would rather find a different hosting provider, this is not relevant for the current state of tech offer.