Proper escaping and closing quotes for image insertion