Skip to content

Instantly share code, notes, and snippets.

@madx
Created December 3, 2008 14:03
Show Gist options
  • Save madx/31546 to your computer and use it in GitHub Desktop.
Save madx/31546 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
class Jaxer
class << self
def json_to_png(json)
# producing image data
File.open('foo', 'w+') do |f|
cmd = "echo"
raise "Failed to convert canvas to PNG." unless system(cmd)
yield(f)
end
end
end
end
get '/' do
Jaxer.json_to_png(params[:data]) do |img|
@str = 'hello'
end
@str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment