Being able to use data: URIs to do interesting things such as inline images is incredibly useful.
IE 8 added support for data URIs but what about older versions of IE (which are still far too prevalent)?
This nice PHP script shows how you can send back data URIs for those who support it, and for older IE, use the message/rfc822 mime type that email clients often use to encode images:
header('Content-type:message/rfc822'); MIME-Version: 1.0 Content-Type: multipart/related; boundary="NEXT_MHTML_DATA_PART" --NEXT_MHTML_DATA_PART Content-Location: Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8" <!-- put the HTML in here including a for loop displaying: --> <div class="img" style="background-image:url(MHTML_IMG<?php echo $index?>)"></div> --NEXT_MHTML_DATA_PART Content-Transfer-Encoding: base64 Content-Type: image/png <!-- the image data here --> --NEXT_MHTML_DATA_PART Content-Location: END_OF_MHTML_FILE Content-Transfer-Encoding: base64 Content-Type: image/png IE_NEED_THIS_TO_END_DATAIf you have better solution, just tell me!
0 comments:
Post a Comment