Praise be to Allah.
Sending blessings and peace upon the Messenger of Allah (blessings and peace of Allah be upon him) is prescribed at all times, because Allah, may He be exalted, says (interpretation of the meaning):
“Indeed, Allah confers blessing upon the Prophet, and His angels [ask Him to do so]. O you who have believed, ask [ Allah to confer] blessing upon him and ask [ Allah to grant him] peace”
Abu Dawood (2041) narrated from Abu Hurayrah that the Messenger of Allah (blessings and peace of Allah be upon him) said: “No one will send greetings of salaam to me but Allah will restore my soul to me so that I may return his greeting of salaam.” Classed as hasan by al-Albaani in Saheeh Abi Dawood.
And there is other evidence which encourages us to send salawaat (blessings) and greetings of salaam to him (blessings and peace of Allah be upon him), especially when his name is mentioned.
So if a person sees a picture of his grave, and remembers him and sends blessings and salaam upon him, there is nothing wrong with that. In fact that is an act of worship and obedience, as noted above.
This is not the salaam of visitation that is recited at his grave; rather it is du‘aa’ (supplication) and praise.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: Are the words “As-salaamu ‘alayka ayyuha’n-nabi (Peace be upon you, O Prophet)” a statement or a supplication? In other words, are you stating that the Messenger is in peace, or asking Allah to send peace upon him?
The answer is that it is a supplication, praying that Allah send peace upon him. Thus it is a statement which is meant as a supplication.
End quote from ash-Sharh al-Mumti‘ (3/150).
With regard to his two noble companions, Abu Bakr and ‘Umar, what is prescribed is to pray that Allah be pleased with them and have mercy on them at all times. As for greeting them with salaam, that is to be done when visiting their graves, not when seeing a picture of the grave on the television or otherwise. That is not prescribed, and no one should think that it is recommended by analogy with the fact that it is recommended to greet the deceased with salaam when standing at his grave, because it drawing an analogy between two different things, and when it comes to acts of worship, they cannot be deemed to be recommended (mustahabb) without shar‘i evidence.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: Deeming something to be recommended (mustahabb) is a shar‘i ruling and cannot be proven except on the basis of shar‘i evidence. Whoever says that Allah loves some deed without shar‘i evidence to that effect has prescribed a religious ruling for which Allah has not given permission, which is as bad as stating that something is obligatory or forbidden (without evidence). Hence the scholars differed with regard to stating what is recommended (mustahabb), just as they differed concerning other matters.
End quote from Majmoo‘ al-Fataawa (18/65).
If someone sees a picture of the grave of the Prophet (blessings and peace of Allah be upon him) and sends greetings of salaam upon him because he has remembered him, there is nothing wrong with that, but this is not the salaam of visitation that is recited at the grave of a deceased person.
With regard to his two companions, it is prescribed to pray that Allah be pleased with them and have mercy on them when one remembers them; it is not prescribed to send greetings of salaam to them.
And Allah knows best.