Quark and gluon fragmentation functions into photons