I feel... like that's not a great idea. Seems like it wouldn't really work, but if it did, you've just armed them and taught them to shoot humans. Expecting then to have the judgement to differentiate between good and bad humans is a tall order. Even hmans have problems with that.
Also, I don't think it would actually help. Elephants aren't lacking for an ability to protect themselves. Having a gun would make them lethal at range, but for that to help would require them to see the poachers before they can be shot, and then to win a gunfight with humans.
You could armor them, but that would probably cause them to overheat, and they'd probably tear it off anyways.
Not sure if trunks are equipped to aim a gun properly, even if designed for them. The book that picture comes from ("Footfall") does address some of the limitations of non bony appendages. The Fithp (space elephants) had guns, but struggled with throwing objects the way a human can.