This is a simple trick that I’m including in the next release of IE7. Mozilla and other browsers already support Base64 encoding of images. This gives web authors the ability to express image URL‘s in this geeky-looking (and therefore cool) way:
1 |
|
That ghastly mess will produce the following image in most decent browsers:
Can’t wait to do it yourself now can you?
Internet Explorer does not support Base64 encoding of images so we will take advantage of PHP’s built-in base64_decode function. We will simply pass the Base64 data back to a module which will then decode the data and return the appropriate image. Now that sounds complicated doesn’t it? Here is the required PHP code:
1 |
|
That wasn’t so bad. Now we need a little bit of JavaScript to pass the Base64 data to the PHP module:
1 |
|
Example: /my/base64-ie.html