The Ashes

Technology, Science and other news
April 25, 2009

Using Base64 encoded images on IE too

Posted by : admin
Filed under : General

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:

PLAIN TEXT
PHP:

  1.  
  2. header(‘Content-type:message/rfc822’);
  3.  
  4. MIME-Version: 1.0
  5. Content-Type: multipart/related; boundary=“NEXT_MHTML_DATA_PART”
  6.  
  7. –NEXT_MHTML_DATA_PART
  8. Content-Location:
  9. Content-Transfer-Encoding: quoted-printable
  10. Content-Type: text/html; charset=“utf-8”
  11.  
  12. <!– put the HTML in here including a for loop displaying: –>
  13. <div class=“img” style=“background-image:url(MHTML_IMG<?php echo $index?>)”></div>
  14.  
  15. –NEXT_MHTML_DATA_PART
  16. Content-Location: MHTML_IMG<?php echo $index?> <!– for each index –>
  17. Content-Transfer-Encoding: base64
  18. Content-Type: image/png
  19.  
  20. <!– the image data here –>
  21.  
  22. –NEXT_MHTML_DATA_PART
  23. Content-Location: END_OF_MHTML_FILE
  24. Content-Transfer-Encoding: base64
  25. Content-Type: image/png
  26. IE_NEED_THIS_TO_END_DATA
  27.  

Very nice, via (@simonw) 🙂

Tags :

No Comments

(required)
(will not be published) (required)
(opitional)

cciash.com EN ES IT DE PT CZ FR RU
June 2018
M T W T F S S
« Sep    
 123
45678910
11121314151617
18192021222324
252627282930  

Pages

Categories

Resources

There are many online poker site where you can play but at poker.hk you can play the poker games with all the knowledge you need related to the game with the poker school available in both the English and Chinese language.

Super Casino

Now you can bet on any sports and any sporting events from all the comfort from your home. Bet770 allows you to bet on any events and match with in just 3 clicks. They also offers great odds on football betting for every premier and champions league match. Get £50 free in bets when you register.

Bingo770, offering best online bingo games with £7.70 free no deposit Bonus!