Like Andrew Thompson comments, these, let's call them medium-range photographs, are taken from the visiting spacecraft, either during approach or during departure. There are several approach and departure modes in use, mainly v-bar (along the target's velocity vector) and r-bar (in the target's radial vector), but sometimes a z-bar (from the side to the velocity vector) approach is also used.
Sometimes, spacecraft would also be repositioned from one docking location to another, so they make room for additional visiting spacecraft or as risk management procedures, something that is done with its complete crew (in case of problems they could simply deorbit and land), so there would be many different angles that the station could be photographed from at these medium-ranges.
I always wanted to tack this video of the One-Year Crew Docking to the International Space Station aboard Soyuz TMA-16M somewhere here, because it's really cool and this One-Year Crew (Scott Kelly and Mikhail Kornienko) is currently on the station. It only shows one rendezvous approach (r-bar docking to the zenith-facing port on the Poisk module) out of the three described, but should give you an overview of what opportunities to take photographs of the station the visiting crew would have:
Closer to the station, photographs can also be taken by astronauts during EVA (Extravehicular Activity), using various point & shoot cameras in protective enclosures and strapped to their suit, but still keeping them relatively small so they don't get in the way of astronaut's work. There wouldn't be any satellites this close to the station because orbital speeds are ludicrous and the station would also perform debris avoidance maneuvers when needed, not to come too close and avoid collision with those that conjunction analysis has shown their orbits cross at some future point in time. But the station does also serve as an orbital launch platform for small CubeSat satellites (in units of 10 cubic centimeters), so it's entirely possible that some future nanosatellite launched from it does take a snap or two of the station and send those to its ground control. To my knowledge tho, that hasn't happened yet.