mimeDecode cid: images help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Blackl3232
Forum Newbie
Posts: 3
Joined: Sat May 29, 2004 11:42 am

mimeDecode cid: images help

Post 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.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

look into regular expressions.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Or you could just saerch for:

<IMG SRC="cid:

and just replace it with:

<IMG SRC="
Blackl3232
Forum Newbie
Posts: 3
Joined: Sat May 29, 2004 11:42 am

Post by Blackl3232 »

the last one wouldnt work becuase the email could have <IMG width=80px; ... src="cid:jgjhghj">
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

wow... do you have a brain??

Then just search for src="cid: and replace it with src="
Blackl3232
Forum Newbie
Posts: 3
Joined: Sat May 29, 2004 11:42 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

how about....
note: slightly tested

Code: Select all

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