Sha256: fe8edd379ec45ff2e32548d4b2c64407114a4915e85d4cf44a4afc513982b406
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require "rubygems" require "bundler/setup" $:.unshift(File.expand_path('../../lib', __FILE__)) require 'dragonfly' Dragonfly.logger = Logger.new(STDOUT) Dragonfly.app.configure do plugin :imagemagick url_format '/images/:job' fetch_file_whitelist [String] end class App def call(env) image = Dragonfly.app.fetch_file('grid.jpg') request = Rack::Request.new(env) error = nil if request['code'] begin img_src = eval("image.#{request['code']}").url rescue StandardError => e error = e end end [ 200, {'content-type' => 'text/html'}, [%( <style> form, input { font-size: 32px; } p.error { color: red; font-size: 24px; } </style> <p class="error">#{error}</p> <table> <tr> <th>Original (#{image.width}x#{image.height})</th> <td><img src="#{image.url}" /></td> </tr> <tr> <th><form>image.<input size="40" autofocus placeholder="thumb('200x100')" name="code" value="#{request['code']}" /></form></th> <td><img src="#{img_src}" /></td> </tr> </table> )] ] end end use Dragonfly::Middleware run App.new
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dragonfly-1.4.1 | dev/test.ru |