Hello,

I have a form whith a TEXTAREA FIELD to retrieve the html text
of a message, and up to 10 file upload fields for images that
may be linked from in that text.

Now the text is uploaded fine, and so are all the images.
Text is saved in UNIQUE_CODE.txt, and images in files
UNIQUE_CODE_01.gif, UNIQUE_CODE_02.jpg, etc etc. All this is OK
too.

The problem is to convert all the SRC strings of the IMG tags in the
original text to relative URLS. i.e. from:

<IMG SRC="C:\dir1\dir2\dir3\img1.gif">
        blah blah blah some text, html markup...
<IMG SRC="img2.jpg">
        blah blah again

to:
<IMG SRC="UNIQUE_CODE_01.gif">
        blah blah blah some text, html markup...
<IMG SRC="UNIQUE_CODE_02.jpg">
        blah blah again

What is the right regexp to handle this, either in a while loop (how?)
or all by itself? The closer I've come to the solution is:

<IMG SRC="UNIQUE_CODE_02.gif">
blah blah blah some text, html markup...
<IMG SRC="UNIQUE_CODE_02.jpg">
blah blah again

Meaning OK if there is only one image, only the last loaded image is
pointed to otherwise, because I keep rewriting the previous tags.

Sorry for not posting my code here, I'm out of town and have just been told of this 
problem by phone by the site owner...

        Any help is appreciated,

                        mweb



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to