Skip to content

Instantly share code, notes, and snippets.

@rodrigoy
Created July 13, 2010 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrigoy/474386 to your computer and use it in GitHub Desktop.
Save rodrigoy/474386 to your computer and use it in GitHub Desktop.
sinatra
rmagick
require 'rubygems'
require 'sinatra'
require 'RMagick'
#How to use Sinatra, RMagick on Heroku
get '/' do
content_type 'image/gif'
img = Magick::Image.new(200, 200)
gc = Magick::Draw.new
gc.gravity = Magick::CenterGravity
gc.pointsize = 32
gc.font_family = "Helvetica"
gc.font_weight = Magick::BoldWeight
gc.stroke = 'none'
gc.annotate(img, 0, 0, 0, 0, "Hello world!")
img.format = "GIF"
img.to_blob
end
require 'application'
run Sinatra::Application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment