Created
April 19, 2011 16:37
-
-
Save igaln/928727 to your computer and use it in GitHub Desktop.
saving a bitmap shot from Flash AS3 with RMagick to Sinatra to Heroku to Amazon s3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post "/newtest/:filename/:title" do | |
image = Magick::Image.from_blob(request.body.read).first | |
puts image.inspect | |
@title = params[:title] | |
@filename = params[:filename] | |
n = VideoThread.new | |
n.title = @title | |
n.created_at = Time.now | |
n.updated_at = Time.now | |
n.save | |
n.colors.create :filename => @filename, :hex_value => "FDD017", :width => 130, :height => 109 | |
AWS::S3::Base.establish_connection!(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) | |
AWS::S3::S3Object.store("#{@filename}.jpg", image.resize(130, 110).to_blob, "theoryclub", :access => :public_read) | |
redirect '/' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment