Displaying Base64binary encoded images

Hi,
I am querying a webservice which returns images as Base64 encoded data.
Displaying these images in Firefox is not a problem:

However, I am having trouble displaying the images in Internet Explorer.
I have been looking at the following page:
Dean Edwards: Base64 Encoded Images for Internet Explorer
which uses a regular expression in Javascript to identify any Base64
images and then uses a PHP function to decode the data and display it
correctly Internet Explorer.
I have been trying to do the decoding of the data in the controller
(rather than having to use the Javascript & PHP method) but I can’t get
it to work:

Controller:
require ‘base64’
@image_data =
“R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw==”

This is Base64 encoded

@image_data_decoded = decode64(@image_data)

View:

@image_data_decoded is a binary string that does work correctly when
passed to the view.
What i am doing wrong?
Thanks

On 26 May 2008, at 11:27, Tim C. wrote:

You can’t just sling binary data into the html like that. If you look
at what the web page you mentionned is doing, what it does is rewrite
the img tags so that they point at some action on your server. that
action then serves up the decoded image (in rails you would use
send_data)

Fred