Another option, which Rails has a lot of good documentation on, is to
create a row in your database which represents the image file, and
contains all the related meta data as well as a unique id number, and
then just keep the actual images in the filesystem named #.jpeg or
some such thing,
Roland just showed you how to inline it.
Here's a little article on the technique he's using:
http://jimbojw.com/wiki/index.php?title=Data_URIs_and_Inline_Images
However, as Jenna said, this technique doesn't work in IE. Her first
suggestion is probably the path of least resistance.
--beppu
Make a controller with a get method to retrieve the image, then, have
some code like this in it, supposing image_data is a string or
something:
headers['Content-Type'] = 'image/png'
headers['Content-Length'] = image_data.length.to_s
return image_data
On 03/02/2009, at 10:58 AM, Cornelius
Mmm, indeededly, though data: uri's don't work at all in internet
explorer, quite the bummer if you care :)
On 03/02/2009, at 12:15 PM, Roland Crosby wrote:
Well, you could sorta do img(:src = file_data), using the data: URI
scheme.
def data_uri(file_data, mime_type=image/png)
4 matches
Mail list logo