Hi Dan,
The function get_the_post_thumbnail
has a filter post_thumbnail_html
that you can use to output the correct image:
add_filter( 'post_thumbnail_html', function( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
$gallery = rwmb_meta( 'field_id', array( 'size' => $size ), $post_id );
if ( empty( $gallery ) ) {
return $html;
}
$image = reset( $gallery );
$html = wp_get_attachment_image( $image['id'], $size, false, $attr );
return $html;
}, 10, 5 );