hello all,

my question is similar to one being discussed here, i have HTML files that may be written by somebody else I am not sure about the coding stle and to show the images when renaming the file I want to change the src attribute of the img tag in the file.

e.g.
From:

<img src="oldfolder"size="xx" />

or

<img size="xx" src="oldfolder" />

To:

<img src="newfolder"size="xx" />

or

<img size="xx" src="newfolder" />

one idea is to use frontpage COM object which provides objects and properties of an html page.

otherone is preg_replace, but I am not ableto form proper regular expression for this option.

    you could try something like

    
    $imgTag = "<img src=\"oldfolder\"size=\"xx\" />";
    $newTag = preg_replace("/oldfolder/", "/newfolder/", $imgTag);
    
    

    If I understood your question correctly, this should work.

      thanks,

      actually i should have mentioned that I dont know what is oldfolder, it could be anything means a variable and I want to set it to new folder.

      I just want to make a general routine that changes src property of img tag to a given folder in a given html file...

      anyway can anyone tell me about using COM component as well, because if I could use that I could change many things in an HTML file.

      rangalo

        Write a Reply...