I found out that I could insert an image into a custom sub-field by just adding the image ID:
update_post_meta($post_id, $metafield, 168);
But that was a lucky guess - I didn't see this info on the documentation for "update_post_meta".
But if I use this way, how do I specify the size of the image? And maybe setting css-classes, such as "alignright"?
Previously I had tried to add the image by writing:
update_post_meta($post_id, $metafield, '<img src="' . $img . '" alt="' . $img_alt . '"/>');
..which required me to get the "src" and specify the size:
$img_id = 233; $img = wp_get_attachment_image_src( $img_id, 'medium');
and get the "alt" by doing:
$img_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true);
So the first option is simpler, but I wonder how to add more specifications to it?