• Content count

  • Joined

  • Last visited

About r_smith

  • Rank
    Forum Newbie
  1. saving images

    Here's some more info on the Rails fix. First, I updated my "imageSaveURL" to be this: imageSaveURL='/graph/imagesave' This should be wherever you're currently writing out your "<chart ..>" tag (mine happens to be in a app/model/graph.rb file we wrote... but it's probably more correctly a view feature, whatever) As long as you're using the updated FusionChart, when you right click your flash graph and tell it to save, the flash object POSTs data to the graph/imagesave page (app/controllers/graph.rb). It will send a "data" paramter with all the image information. That's what I'm loading into "cdata" near the top (along with the other POST parameters being sent from the Flash object). cdata = params[:data] Outside of that, it's pretty much a coversion of the PHP code from FusionCharts. I've only tried this on Linux boxes with Rails (1.2.x) so I'm not sure if there's any strange Windows issues (I've read Ruby Inline for windows requires a compiler to be installed, which could be a pain... http://www.thewebfellas.com/blog/2007/12/2/imagescience-and-rubyinline-on-windows ). The PNG gem requires Ruby Inline which is why you need this. The alternative would be to rewrite the script to use RMagick... which can be a pain to install on unix systems (and why I went with the PNG gem, but that sounds like it might be simple to install on Windows). I did notice a bit of an issue when I deployed this into production. If your rails process is not running as root (which it shouldn't be for security reasons), you might get an error about permissions writing to "/root/.ruby_inline". The PNG plugin uses Ruby Inline which needs to write some object files out when it runs (and compiles its C code/objects). Here's the way I fixed it by explictly setting the HOME env variable. My rails process runs as the user "mongrel". Change that line as needed below, but I placed this in a file config/initializers/ruby_inline.rb with the line: ENV['HOME'] = "/home/mongrel" if ENV['RAILS_ENV'] == 'production'
  2. saving images

    I'm using FusionCharts with Ruby on Rails and this new feature is great... unfortunately there doesn't seem to be the server side component for this yet in Rails. From anyone who has coded this in the other languages, do you think this lightweight PNG gem would be able to handle the chart data? http://rubyforge.org/frs/shownotes.php?group_id=1513&release_id=10680 Or are we better off looking at RMagick? http://rmagick.rubyforge.org ~Thanks