Using Select2 for image based dropdown


Hello everyone,
So I am developing a simple application in which I have to use a phone number input that will be displayed as a popup after a user logs in so I have to basically make an image-based dropdown selector. So a country flag icon will be displayed on the left of the input a clicking upon which a dropdown menu will appear which will have the options with a flag, the country name, and the caller code.
Now selecting the option will update the image in the selector and add the caller code to the input.
Is this possible to do with select2 and if yes then how do I achieve it?
Here is an example of what I wanna do: