TITLE: Image of a map on cohomology rings
QUESTION [13 upvotes]: The following seems like an extremely basic algebraic topology question, but it's not something I ever learned, nor does it look familiar to the algebraic topologists I've asked.

Let $f:X\to Y$ be a map, inducing $f^*:H^*(Y)\to H^*(X)$. Hence the image $R$ of $f^*$ is a subring of $H^*(X)$. Is there a natural way to factor $f$ as $X \to Z \to Y$, such that $f^*$ factors as $H^*(Y) \twoheadrightarrow R \hookrightarrow H^*(X)?$

I have a particular $X,Y$ in mind (the inclusion of one compact complex manifold into another, each with even-degree cohomology) but I'm hoping phrases like "Postnikov tower", "cofibrant replacement", "mapping cone" will serve to give a general answer.

REPLY [10 votes]: One special case of your set up is when $Y=X$ and $f^*$ is idempotent: $f^* \circ f^* = f^*$.  In this case, let $Z$ be the mapping telescope of $X \xrightarrow{f} X \xrightarrow{f} X \rightarrow \dots$. This comes with a canonical map $r: X \rightarrow Z$ such that $r^*$ is monic with image equal to the image of $f^*$, and in many cases, one can show that there exists $i: Z \rightarrow X$ such that $r^* \circ i^* = f^*$.  
(We are basically looking to lift an idempotent in homology to an idempotent in homotopy.  One sufficient condition for $i$ to exist is that $X$ be a $p$--complete CW complex of finite type: see the short paper Atomic spaces and spectra I wrote with J.F. Adams back in the late 1980's.)