I want to replace a image with html code, that must be the output of a php function. whenever a image tag is found in an html document, it should be passed to a php function and replaced with a html strings. my expectation is like below.
index.htm file contains
     hello <img src="image.jpg" /> sentence continuation.
this image.jpg is passed to php function like 
    convert_pic('image.jpg');
so the output of index.htm is 
    hello <div>....</div> sentence continuation.
where <div>....</div> is the out put of php function convert_pic('image.jpg');
so <img src="image.jpg" /> is to be replace by <?php convert_pic('image.jpg');
how it can be done, or any other possibility to attain this?
 
     
    