Skip to content

Instantly share code, notes, and snippets.

@koyachi
Created November 27, 2008 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koyachi/29744 to your computer and use it in GitHub Desktop.
Save koyachi/29744 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
require 'barcodescanner'
require 'logger'
log = Logger.new(STDOUT)
get '/' do
'BARCODE SCANNER WEB!'
end
post '/upload' do
imgdata = request.body
File.open('aaa.png', 'wb') {|f|
f.write imgdata.read
}
redirect '/result', 301
end
get '/result' do
code = BarcodeScanner.process_image_file('aaa.png')
log.info "BARCODE = #{code}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment