Changeset 6342


Ignore:
Timestamp:
05/29/12 14:59:03 (8 years ago)
Author:
cristiano
Message:

Ticket #2778 - Melhoria no desenpenho da regex para imagens grandes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.1-2/expressoMail1_2/inc/class.imap_functions.inc.php

    r6259 r6342  
    52895289        {  
    52905290                $matches = array(); 
    5291                 preg_match_all("/src=[\'|\"]+data:([^;]*)(.*);base64,([a-zA-Z0-9\+\/\=]+)[\'|\"]+/i", $body, $matches,  PREG_SET_ORDER); //Resgata imagens em rfc2397 
     5291                preg_match_all("/src=[\'|\"]+data:([^,]*);base64,([a-zA-Z0-9\+\/\=]+)[\'|\"]+/i", $body, $matches,  PREG_SET_ORDER); //Resgata imagens em rfc2397 
    52925292                                 
    52935293                foreach ($matches as $i => &$v) 
    52945294                { 
    5295                         $mailService->addStringImage(base64_decode($v[3]), $v[1] , 'EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1])); 
    5296                         $body = str_replace($v[0], 'src="EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1]).'"' , $body); 
     5295                        $ext = explode(';', $v[1]); //quebra todos os parametros em um array. 
     5296                        $mailService->addStringImage(base64_decode($v[2]), $ext[0] , 'EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1])); 
     5297                        $body = str_replace($v[0], 'src="EmbeddedImage'.$i.'.'.$this->mimeToExtension($ext[0]).'"' , $body); 
    52975298                } 
    52985299        } 
Note: See TracChangeset for help on using the changeset viewer.