Posted By

balmeet80 on 02/22/13


Tagged

htmlphpimagecssbase64converter


Versions (?)

Image To Css To Prevent Image Blocking From Email Clients


 / Published in: HTML
 

By using the Data URI scheme you can embed images directly into your HTML and CSS. It works by encoding an image into a base64 string and place it directly withing an HTML image tag or as a CSS background URL

Email Client support

Following clients support data uri for images[3]

Apple Mail 4
BlackBerry Curve
HTC HD7
iPad 2
iPhone 3GS
LG Optimus
Lotus Notes 8
Me.com
Nokia N96
Outlook 2003
Thunderbird 3
Yahoo! Mail
  1. <!-- Use In Img tag ->
  2. <img alt="" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/AAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAAABzAAAAEBkZXNjAAAAAAAAAANjMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0ZXh0AAAAAEZCAABYWVogAAAAAAAA9tYAAQAAAADTLVhZWiAAAAAAAAADFgAAAzMAAAKkWFlaIAAAAAAAAG+iAAA49QAAA5BYWVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPY3VydgAAAAAAAAAaAAAAywHJA2MFkghrC/YQPxVRGzQh8SmQMhg7kkYFUXdd7WtwegWJsZp8rGm/fdPD6TD////b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MxUOBr2dduCvej6xcFxoB39tT0c5DSu0Kns93K24RjDj1f/Z" />
  3.  
  4.  
  5.  
  6. <!-- OR USE Through CSS ->
  7.  
  8. ackground-image: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/AAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAAABzAAAAEBkZXNjAAAAAAAAAANjMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0ZXh0AAAAAEZCAABYWVogAAAAAAAA9tYAAQAAAADTLVhZWiAAAAAAAAADFgAAAzMAAAKkWFlaIAAAAAAAAG+iAAA49QAAA5BYWVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPY3VydgAAAAAAAAAaAAAAywHJA2MFkghrC/YQPxVRGzQh8SmQMhg7kkYFUXdd7WtwegWJsZp8rGm/fdPD6TD////bAEMABQQEBAQDBQQEBAYFBQYIDQgIBwcIEAsMCQ0TEBQTEhASEhQXHRkUFhwWEhIaIxocHh8hISEUGSQnJCAmHSAhIP/bAEMBBQYGCAcIDwgIDyAVEhUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIP/CABEIAEgAZAMAIgABEQECEQH/xAAbAAEA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9sOIjTrJx//xAAeEQEAAgICAwEAAAAAAAAAAAABABEhMRBBIFFhcf/aAAgBAREBPxCLUDRECA396gTMVl8oA5dvoiUakIFBUtAo5/O5qLUDlow9xamViVXO5dKEywzXh//EACUQAQACAgIBBAIDAQAAAAAAAAERIQAxQVFhIHGBkRCxocHw8f/aAAgBAAABPxD0uYIU8GUZXgFcACAZGDt4+t98QAvcMsLEpVvDnGQxKn3ZXFKEl43oQQ/Y9pGiQbNlSvI+qUA7VSB2BXcndwDLqkhZocAIIGVbgvHJE2BIuS2FLEyYgS1LNAga9Uh3m9AtpQRKgTJggpa6r7uOX1joP2pMC8QEIImphxIc0Phgf879X+SK1cfLolrJmiGKgEO7ZBQo5rHXJhGbkJ00iXBCLjBOyfJzzgAb0EBhEgSXQZIMP2UCviT8Ys655eAP3PpTdVmzflZJmtHQ2GguJgPKXhiPhDQTWYs0mxCRkADivtrAT7VktJlThbIgopyX+HFnudE3wEH2GFi03oIl2i4acBKAQNbF8svpBXg8S0L5TlaXklCg62klpTpAOp4EijQr/qGg4+/yEVxGgN4xgW2gWR5mWTkcYJFgbgA9GC/+/SYJhGgLXJFmuFcXcrEc+TAAufsKVcCJtE4ehANmG6Mmu13qLhR6GQIWmhxUythMEqzkfA21p5W/SkIAeRU+mCuIQ8oJOYQvGAq4V92/5L+ZkVHuX6Gjgt4ntS79OrgtsjKRbOObhrEcMFAVqqAoPVk5wYjLYZ/jJ+l+AlPJgPHl6C3jJGJjmF2tem/YyQTZKN0uVW4LXq8NxmpkL/EvFGjmQYAPVE8mUQyZRw6fC5J0A8NDrhgRKSEkckMeXfppJGkQMxUOBr2dduCvej6xcFxoB39tT0c5DSu0Kns93K24RjDj1f/Z);

Report this snippet  

You need to login to post a comment.