Prev: Encoding/decoding a image as Base64 (fails under Ruby1.9 but worksunder Ruby1.8)
Next: How to Make Fast Online Money to Fill Your PayPal Account
From: Iñaki Baz Castillo on 2 Dec 2009 19:27 El Jueves, 3 de Diciembre de 2009, Iñaki Baz Castillo escribió: > The difference is in the second step, the decoding process, since > "base64.txt" file is the same using Ruby1.8 or 1.9. Ok, the issue is fixed by uing "IO.read" rather than "IO.readlines": - Decode "base64.txt" as a PNG "new_icon.png" file: -------------------------------------- File.open('new_icon.png', 'wb') do |file| file << (IO.read('base64.txt').to_s.unpack('m')).first end -------------------------------------- -- Iñaki Baz Castillo <ibc(a)aliax.net> |