mattetti / googlecharts

Ruby Google Chart API
http://mattetti.github.com/googlecharts/
MIT License
699 stars 108 forks source link

PNGs do not write correctly on windows #11

Closed victorklos closed 14 years ago

victorklos commented 14 years ago

Found out that PNGs do not write correctly to file on windows, at least not on vista. Solution is to change file open flags to "wb+" in method write(), as follows:

def write(io_or_file=@@file_name)
  return io_or_file.write(fetch) if io_or_file.respond_to?(:write)
  open(io_or_file, "wb+") { |io| io.write(fetch) }
end

thanks to the clear explanation of why the PNG header is like it is on wikipedia.

Cheers, Victor

mattetti commented 14 years ago

thanks, patch made but not available in 1.5.0 (will be in next release)