Some people have applied for a e visa at a embassy or official consulate in their home country while here. But there are some warnings about it on the e visa site and embassy/consulate websites.
Personally I see no big advantage of doing the e visa while here rather than at a nearby embassy or consulate. You would still have to leave and re-enter the country and the e visa application has requires flights in and out of Thailand that is not required at a nearby embassy or consulate,