Yeah, don’t do that.
The database is not made to store HTML, HTML and PHP are made for that.
You’ll want to just save the image. For example:
update_post_meta($post_id, $name, $img);
$name is the name of the postmeta in the database and $img is the URL of the image.
To later on display the image:
<img src="https://wordpress.stackexchange.com/questions/212643/<?php echo get_post_meta($post_id, $name, true);?>
This will return the image. If you want to store more information about the image (height, width, etc) you will need to store them seperately, or store all the information in 1 array.
Storing in an array:
$content = array("img'=>$imageurl,
'width' => $width,
'height' => $height,
'othertotalyawesomeoption' => $other
);
update_post_meta($post_id, $name, $content);
To output the image:
<?php $data = get_post_meta($post_id, $name, true);?>
<img src="https://wordpress.stackexchange.com/questions/212643/<?php echo $data["img'];?>" height="https://wordpress.stackexchange.com/questions/212643/<?php echo $data["height'];?>" width="https://wordpress.stackexchange.com/questions/212643/<?php echo $data["width'];?>">