Changeset 6242 for trunk/expressoMail1_2/inc
- Timestamp:
- 05/18/12 17:56:02 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r6240 r6242 3075 3075 //////////////////////////////////////////////////////////////////////////////////////////////////// 3076 3076 3077 3078 $this->rfc2397ToEmbeddedAttachment($mailService , $body);3079 3080 3077 if ($isHTML) 3081 3078 $mailService->setBodyHtml($body); … … 3731 3728 return "application/octet-stream"; 3732 3729 } 3733 3734 3730 3735 3731 function htmlspecialchars_encode($str) 3736 3732 { … … 5275 5271 return $ret; 5276 5272 } 5277 5278 /**5279 * Método que convert imagens no formato rfc2397 para Embedded Attachment5280 *5281 * @license http://www.gnu.org/copyleft/gpl.html GPL5282 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)5283 * @sponsor Caixa Econômica Federal5284 * @author Cristiano Corrêa Schmidt5285 * @param <MailService> <$mailService> <Referencia objeto MailService>5286 * @param <String> <$body> <Referencia Corpo do email>5287 * @return <void>5288 * @access <public>5289 */5290 function rfc2397ToEmbeddedAttachment( &$mailService , &$body )5291 {5292 $matches = array();5293 preg_match_all("/src=[\'|\"]+data:([^;]*)(.*);base64,([a-zA-Z0-9\+\/\=]+)[\'|\"]+/i", $body, $matches, PREG_SET_ORDER); //Resgata imagens em rfc23975294 5295 foreach ($matches as $i => &$v)5296 {5297 $mailService->addStringImage(base64_decode($v[3]), $v[1] , 'EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1]));5298 $body = str_replace($v[0], 'src="EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1]).'"' , $body);5299 }5300 }5301 5302 /**5303 * Método que retorna a extensão do arquivo atraves do mime type5304 *5305 * @license http://www.gnu.org/copyleft/gpl.html GPL5306 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)5307 * @sponsor Caixa Econômica Federal5308 * @author Cristiano Corrêa Schmidt5309 * @param <String> <$mimeType> <Mime Type do arquivo>5310 * @return <String> <extensão>5311 * @access <public>5312 */5313 function mimeToExtension($mimeType)5314 {5315 switch ( $mimeType )5316 {5317 case 'image/bmp' :5318 return 'bmp';5319 case 'image/cgm' :5320 return 'cgm';5321 case 'image/vnd.djvu' :5322 return 'djv';5323 case 'image/gif' :5324 return 'gif';5325 case 'image/x-icon' :5326 return 'ico';5327 case 'image/ief' :5328 return 'ief';5329 case 'image/jpeg' :5330 return 'jpg';5331 case 'image/x-macpaint' :5332 return 'mac';5333 case 'image/pict' :5334 return 'pct';5335 case 'image/png' :5336 return 'png';5337 case 'image/x-quicktime' :5338 return 'qti';5339 case 'image/x-rgb' :5340 return 'rgb';5341 case 'image/tiff' :5342 return 'tif';5343 default:5344 return '';5345 }5346 5347 }5348 5349 5273 } 5350 5274 ?>
Note: See TracChangeset
for help on using the changeset viewer.