It is obtained on arrival at the airport. No need an ID photo. On the plane, the flight attendants / steward will give you a small form named “passport for Madagascar” to fill out. At the exit of the plane, take the line “Without Visa” where you will give the form to the customs. In 2019 the Visa cost was 35 Euros for 30 days stay.
The “e-visa” is currently being drafted: online payment of the visa before departure. It might be set up in 2020