Is there a function to replace one image with another
Example
I want to replace the external image in the output
<img src="http://pierre.chachatelier.fr/programmation/images/mozodojo-original-image.jpg" alt="" class="thumbnail ">
with a internal image
<img src="http://www.alforat.org/attachments/4309d1250860423-12image-insolite02.jpg" alt="" class="thumbnail ">
What you want to use is Javascript, not PHP.
Php is server-side language, while Javascript is client-side.
To make your life with Javascript easier, You should use jQuery, try setting an id for your img and then :
About how to handle that, where to put it and how to write Javascript, try Here