There are two possible ways to take photographic picture of the train:
An observer who is at rest in the frame of the rail places many infinitesimal cameras along the embankment in the immediate vicinity to the passing train. These cameras make click simultaneously in the embankment's frame. Then this observer glue all "small" pictures into single "long" picture. The train will appear Lorentz - contracted on the film.
An observer takes picture from some distance from the train. In this case spatial position of the camera wrt the train plays important role and picture depends on it and this observer must take into account light propagation time, or so called light - time correction.
If this observer will take picture exactly at that moment when the center of the train IS just opposite of the aperture of his camera (light received at points of closest approach), the train will appear $\gamma$ times stretched. The observer may give double explanation to this picture:
2.1) The train is moving and I am at rest. The rays that simultaneously go through the aperture of my camera have been emitted at different moments in the train's frame, so I see the train "in the past" when the ends of the train were at different distances from the aperture and were emitted at different moments, that's why the train appears stretched, even though it is actually contracted.
2.2) Relativity allows to consider this "vice versa setup" - the train is "at rest" and the camera (and the observer) is moving at the moment when it takes the picture. Sure the picture is still the same or $\gamma$ times stretched, but now we think in the terms of train's rest frame. The rays of light that had been simultaneously emitted from the ends in the trains frame will simultaneously pass through the aperture and simultaneously hit the film, since rays of light from the ends of the train to aperture and from aperture to the film form similar triangles. The observer may explain "stretched" picture as due to Lorentz - contraction of the film in the camera.
There is one more possible setup - the camera takes picture of the light that was emitted at points of closest approach. In this case the train will appear $\gamma$ times contracted.