From 20081d7d61379587de5fc68e4a1f42585c801875 Mon Sep 17 00:00:00 2001 From: Junv Zhao Date: Mon, 29 Feb 2016 23:57:57 +0800 Subject: [PATCH] add rmagick --- Gemfile | 1 + Gemfile.lock | 2 ++ app/controllers/api/v1/ocr_controller.rb | 2 ++ 3 files changed, 5 insertions(+) diff --git a/Gemfile b/Gemfile index c144a89..5daa72f 100644 --- a/Gemfile +++ b/Gemfile @@ -83,6 +83,7 @@ gem 'font-awesome-rails', '~> 4.4' gem "sentry-raven" #, :github => "getsentry/raven-ruby" gem "paranoia", "~> 2.0" gem 'faraday' +gem 'rmagick' group :development do gem 'capistrano' diff --git a/Gemfile.lock b/Gemfile.lock index 45fc634..152daf6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -302,6 +302,7 @@ GEM rest-client (1.7.3) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) + rmagick (2.15.4) rspec (3.3.0) rspec-core (~> 3.3.0) rspec-expectations (~> 3.3.0) @@ -446,6 +447,7 @@ DEPENDENCIES rails_12factor redis (~> 3.2.1) rest-client + rmagick rspec-rails (~> 3.0) rspec-sidekiq rvm1-capistrano3 diff --git a/app/controllers/api/v1/ocr_controller.rb b/app/controllers/api/v1/ocr_controller.rb index fcdd082..07a8e2b 100644 --- a/app/controllers/api/v1/ocr_controller.rb +++ b/app/controllers/api/v1/ocr_controller.rb @@ -5,6 +5,8 @@ class Api::V1::OcrController < ApplicationController API_URL = 'http://apis.baidu.com/idl_baidu/baiduocrpay/idlocrpaid' def index + img = Magick::Image.read('/Users/twer/Desktop/1.jpg') + ap img image_base_str = Base64.strict_encode64(IO.read('/Users/twer/Desktop/1.jpg')) # conn = Faraday.new(:url => API_URL) do |faraday| # faraday.request :url_encoded