Scientists are not yet certain how photographic memory works, but there are several theories.
Perhaps visual memory consumes many regions of the brain that are supposed to be specialized for other purposes. People can have diminished capacity in certain areas such as spatial thinking, social skills, or language, while having extraordinary talent in a single hobby. This explains why savants and autistics have damaged social capacity.
Perhaps enhanced emotion is involved, which would deeply ingrain a memory in a more dense fashion than normal. Perhaps attention is merely extremely focused on image detail. Perhaps there is some elongation of short-term memory, which would solidify image patterns in memory.
Eidetic memory (frickin’ humongous memory storage) can occur for any sense. It seems to me likely that a combination of these theories may be responsible.