A determination of the pion-nucleon coupling constant from pion photoproduction