Page 1 of 1

mimeDecode cid: images help

Posted: Sat May 29, 2004 11:42 am
by Blackl3232
i have a script that uses mimedecode to get the html part out of a mime message and everything works fine except for images. i need a way to get the <IMG SRC="cid:some_stuff457468"> to work. right now i save the file then replace all cid: with blank but this doesnt work good becuase if cid: is in their message it will remove it.

Posted: Sat May 29, 2004 11:48 am
by Illusionist
look into regular expressions.

Posted: Sat May 29, 2004 11:50 am
by Illusionist
Or you could just saerch for:

<IMG SRC="cid:

and just replace it with:

<IMG SRC="

Posted: Sat May 29, 2004 11:55 am
by Blackl3232
the last one wouldnt work becuase the email could have <IMG width=80px; ... src="cid:jgjhghj">

Posted: Sat May 29, 2004 12:54 pm
by Illusionist
wow... do you have a brain??

Then just search for src="cid: and replace it with src="

Posted: Sat May 29, 2004 3:06 pm
by Blackl3232
that wont work becuase if src="cid: is in their message itll delete it.

i figured out how to do it using regular expressions

Posted: Sat May 29, 2004 8:49 pm
by feyd
how about....
note: slightly tested

Code: Select all

preg_replace("|(<img[^>]*?\s*?src\s*?=\s*?")cid:|is","\\1",$line);