images in db
Jenna Fox
blueberry at creativepony.com
Mon Feb 2 20:23:31 EST 2009
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")
> "data:#{mime_type};base64,#{[file_data].pack('m*')}".strip
> end
>
> Then you could just do img(:src => data_uri(file_data)), and it
> should work.
>
> On Mon, Feb 2, 2009 at 6:58 PM, Cornelius Jaeger <cjlists at visualfood.ch
> > wrote:
>> hi all
>>
>> just working on my first camping hack and new to ruby as well.
>> i've figured some things out and uploading images into the
>> database, but i'm
>> not sure how to get the data displayed in the browser.
>> i'd like to stream it straight from the db, not copy it to the fs
>> first.
>> obviously img(:src => file_data) doesn't work.
>> any pointers or reading assignments would be v. welcome.
>> many thanks
>>
>> cornelius
>> _______________________________________________
>> Camping-list mailing list
>> Camping-list at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/camping-list
>>
> _______________________________________________
> Camping-list mailing list
> Camping-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
More information about the Camping-list
mailing list