PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Mime » Bug #4758

Inline/HTML images don't display as background images

Details

Submitted2005-07-06 15:51 UTC
Frompear dot bugs at login dot hedim dot ch
Assignedcipri
StatusClosed
PackageMail_Mime
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-07-06 15:51 UTC] pear dot bugs at login dot hedim dot ch

Description:
------------
Background images in the HTML body of the mime mail don't display. This is because get() replaces file names of images added using addHTMLImage() only by the image's cid when they appear in src= attributes, but not in background= attributes (of <body> or <td> tags for example).

Reproduce code:
---------------
Set a HTML body that contains:
<td background="header.jpg">

Add the corresponding image:
$mime_mail->addHTMLImage(
$image, // contains the JPEG image
"image/jpeg",
"header.jpg",
false);

We suggest the following changes to mime.php (replace the file name whether it appears in src *or* background attributes):

Line #463:
$regex = '#(src|background)\\s*=\\s*(["\']?)' . preg_quote($value['name']) .

Line #465:
$rep = '\\1=\\2cid:' . $value['cid'] .'\\3';

Expected result:
----------------
In the body of the final e-mail, something like:
<td background="cid:7c0b518a941bfcea97c9053ccf082622">

Actual result:
--------------
<td background="header.jpg">