I want to answer this question with a relatively complete discussion.
Instead of investigating different situations, we can use the following lemma:
Lemma: Suppose $\phi$ is a group homomorphism and $H \lhd G$, then $$\frac{G}{\phi^{-1}\circ\phi (H)} \cong \frac{\phi(G)}{\phi(H)} $$
Proof: If we define $\sigma: G \rightarrow \frac{\phi(G)}{\phi(H)}$ such that $\sigma(g)=\phi(g) \phi (H)$, then $\sigma$ is a well-defined onto homomorphism whose kernel is $\phi^{-1}\circ\phi (H)$, and the proof is followed by the first isomorphism theorem.
Lemma: Let $\phi$ be a group homomorphism. If $\ker(\phi)\subset H$, then $\phi^{-1}\circ\phi (H) =H$.
Proof: $H \subset \phi^{-1}\circ\phi (H)$ is obvius.
Suppose there exists $g \not \in H$ such that $\phi(g) \in \phi(H)$, then there exists $h \in H$ such that $\phi(g)=\phi(h)$. This implies $gh^{-1} \in \ker{\phi}$, but $gh^{-1} \not \in H$, which is a contradiction to the fact that $\ker(\phi)\subset H$. Hence, $ \phi^{-1}\circ\phi (H) \subset H$, and the proof is completed.
Now, if $\phi$ is onto then $\phi(G_1)=G_2$, and if $\ker(\phi)\subset H_1$, then $\phi^{-1}\circ\phi (H_1) =H_1$. Hence, acording to $\phi(H_1)=H_2$, your result is followed.