Ruby on Rails Wednesday, May 13, 2015

You might be able to look at https://github.com/madrobby/spark_pr

which can be extended with:

SparkCanvas.class_eval do
def to_uri
require 'base64'
# doesn't attempt to respect some limits noted in RFC 2397 since the data:
# url is supposed to be 'short' (1k), but the meaning of that word has changed
# a bit since 1998.
# Modern browsers allow 4k-32k or more According to http://dataurl.net/#about
%{data:image/png;base64,#{Base64.encode64(to_png).gsub("\n",'')}}
end
end

and work it backwards.

-Rob

On 2015-May-13, at 19:03 , Walter Lee Davis <waltd@wdstudio.com> wrote:

> I would start here: http://ruby-doc.org/stdlib-2.2.2/libdoc/base64/rdoc/Base64.html#method-i-decode64
>
> Save the result to a file on disk.
>
> Walter
>
> On May 13, 2015, at 6:18 PM, Gm <javaplayer@gmail.com> wrote:
>
>> Hi,
>>
>> I have the following base64:
>>
>> data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXMAAAB/CAIAAACSbbUKAAAKsGlDQ1BJQ0MgUHJvZmlsZQAASA2tlndUk8kaxuf70hstIRQpoXekV+k1FOlVVEISSCgxBIKIqKgsruCKIiICFtCVpuCq1LUgFkRdBBv2BVlU1OtiQVRU7he4ZPece/e/O+fMzC/v92TKOzPnPACQK1lCYTosB0CGIFsU7ufJiI2LZ+B+BxDAAAKgA0UWO0voERoaBP6xfLyLqJFyy0wy1j/K/vcHeQ43iw0AFIp8TuJksTMQPoXUArZQlA0AygaJ667OFko4FmGaCFkgwpJ5aCnzXCDhpHkun9NEhnshmgYA8GQWS5QCAOkUEmfksFOQcUi3EbYQcPgCAMhohF3ZPBYHYW+ETTMyVklYiLBh0t/GSfkbs1hJ0jFZrBQpz+8F+ScysTc/S5jOWjP34//ZZKSLkXzNFQ2kJWelRQQiPR7JWS6b5ROxwDwuU3Jmc3Fhtmf4AvOzmZELzBP7Ry2wOC3KY4HTVgVK9YKkpSELcXaWF5L7+THzeJExC8zhevsssGhVuFSflRMhjefxvJYuaFJZAZLznlsbS4TQf5ib7iedV5gdKl2nIH2pdC/JIl+phpv1136zeZH+C+NkiyKlmmS+L3MhzhP5S+PC9Lk7PbcGkThcmgeuIEqaQw7LW5pbwAfBgAXY2dxc5A4B4LVKuEbET+FlMzyQW881ZTAFbHNThpWFpS2QvCGJBoD39Lm3AdGv/hXL7AHAsRg5L8n1ZUhUALB0AOh6BgD1418xnXfI8e4A4MwgWyzKmddJrivyMolAFtCACtAAOsAQmAErYAecgTvwAQEgBESCOLACsAEPZAARWA3ywUZQBErADrAbVIED4BBoAMfACdABToPz4DK4BgbBHfAQjIBx8ApMgo9gBoIgHESBqJAKpAnpQSaQFeQAuUI+UBAUDsVBiVAKJIDEUD60GSqByqAqqBZqhH6BuqDzUD80BN2HRqEJ6B
>>
>> Is there a way to generate a PNG or JPG from this code using rails ?
>>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/adca2adf-95a0-45ed-a472-25e89ffd79b4%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/F09CA941-9375-4221-94FB-641400541C67%40wdstudio.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CF5408C0-EC23-4874-A8DD-02C049AB3264%40agileconsultingllc.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment