kimaniwamwangi / php-mime-mail-parser

Automatically exported from code.google.com/p/php-mime-mail-parser
0 stars 0 forks source link

Inline Pictures Not Retrievable #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If someone pastes a picture into an email and sends it there is no way to
access it.  $Parser->getAttachments() returns null. 
$Parser->getMessageBody('html') or 'text' returns everything without the
picture. Is this a bug that is known or being worked on?

Thanks!

Original issue reported on code.google.com by urif...@gmail.com on 21 Mar 2010 at 2:19

GoogleCodeExporter commented 9 years ago
Same issue,

The raw email as the <img src="cid:blahblahblah">
Also the MIME area with content-id <blahblahblah>

But the parser seems to be ignoring it.

Original comment by scubasco...@gmail.com on 5 Jan 2011 at 2:56

GoogleCodeExporter commented 9 years ago
I created this function to get images from the email whether they are inline or 
attachments.  Add it below getAttachments() function or extend the 
MimeMailParser class.

        public function getImages() {
                $matches = array();
                $imgs = array();
                $i = 0;
                foreach($this->parts as $part) {
                        $content_type = $this->getPartContentType($part);
                        preg_match('/^.*image\/(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG).*(name=(.+))?$/',$content_type, $matches);
                        if (isset($matches[1])) {
                                $partDispo = $this->getPartContentDisposition($part);
                                $disposition = ($partDispo) ? $partDispo : 'inline';
                                $file_name = (isset($matches[3])) ? $matches[3] : false;
                                if ( ! $file_name) (isset($part['disposition-filename'])) ? $part['disposition-filename'] : 'some_img'. $i .'.'. $matches[1];
                                $imgs[] = new MimeMailParser_attachment(
                                        $file_name,
                                        $content_type,
                                        $this->getAttachmentStream($part),
                                        $disposition,
                                        $this->getPartHeaders($part)
                                );
                        }
                        $i++;
                }
                return $imgs;
        }

Original comment by brodie.h...@gmail.com on 17 Feb 2011 at 9:39

GoogleCodeExporter commented 9 years ago
It would be great that image paths are converted to real path of saved (grab) 
images

Original comment by epicgo...@gmail.com on 22 Feb 2012 at 9:08

GoogleCodeExporter commented 9 years ago
This issue is reproduced, corrected and tested 
(https://github.com/eXorus/php-mime-mail-parser/issues/4)

You could use my fork if you want : 
https://github.com/eXorus/php-mime-mail-parser

Original comment by eXorus.m...@gmail.com on 28 Jul 2013 at 4:24