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. This year (2018), the Visa cost is 35Euros for 30days stay.
The “e-visa” is currently being drafted: online payment of the visa before departure. It might be set up by the end of 2018