læse inline-image i mail - hjælp til class
Hej. Jeg har problemer med at læse et billede i en email når den er inline og ikke attachment.Jeg bruger nedenstående klasse, og den er ok, men jeg kan ikke få den til at læse inline... kan ikke finde ud af at få den til at læse den rette del :-/ Kan i pointe mig videre i den rette retning?
------------------------->
class readattachment
{
function getdecodevalue($message,$coding)
{
if ($coding == 0)
{
$message = imap_8bit($message);
}
elseif ($coding == 1)
{
$message = imap_8bit($message);
}
elseif ($coding == 2)
{
$message = imap_binary($message);
}
elseif ($coding == 3)
{
$message=imap_base64($message);
}
elseif ($coding == 4)
{
$message = imap_qprint($message);
}
elseif ($coding == 5)
{
$message = imap_base64($message);
}
return $message;
}
function getdata($host,$login,$password,$savedirpath)
{
$mbox = imap_open ($host, $login, $password) or die("can't connect: " . imap_last_error());
$message = array();
$message["attachment"]["type"][0] = "text";
$message["attachment"]["type"][1] = "multipart";
$message["attachment"]["type"][2] = "message";
$message["attachment"]["type"][3] = "application";
$message["attachment"]["type"][4] = "audio";
$message["attachment"]["type"][5] = "image";
$message["attachment"]["type"][6] = "video";
$message["attachment"]["type"][7] = "other";
for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++){
$structure = imap_fetchstructure($mbox, $jk , FT_UID);
$parts = $structure->parts;
$fpos=0;
for($i = 0; $i < count($parts); $i++)
{
$message["pid"][$i] = ($i);
$part = $parts[$i];
print_r($part);
if($part->disposition == "INLINE"){
$message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype);
echo $message["type"][$i].'<br>';
$message["subtype"][$i] = strtolower($part->subtype);
$ext=$part->subtype;
$params = $part->dparameters;
$filename=$part->dparameters[$i]->value;
echo $filename;
$mege="";
$data="";
$mege = imap_fetchbody($mbox,$jk,$fpos);
$filename="$filename";
$fp=fopen($filename,w);
$data=$this->getdecodevalue($mege,$part->type);
fputs($fp,$data);
fclose($fp);
$fpos+=1;
}
}
//imap_delete($mbox,$jk);
}
//imap_expunge($mbox);
imap_close($mbox);
}
}
<--------------------