This commit is contained in:
nilsding 2014-12-29 14:49:57 +01:00
parent 079ba103ec
commit 4adc6eec09
3 changed files with 20 additions and 2 deletions

View File

@ -48,5 +48,9 @@
height: Math.round(ry * preview[0].naturalHeight) + 'px'
marginLeft: '-' + Math.round(rx * coords.x) + 'px'
marginTop: '-' + Math.round(ry * coords.y) + 'px'
($ '#crop_x').val Math.floor(coords.x)
($ '#crop_y').val Math.floor(coords.y)
($ '#crop_w').val Math.floor(coords.w)
($ '#crop_h').val Math.floor(coords.h)
fr.readAsDataURL(input.files[0])
fr.readAsDataURL(input.files[0])

View File

@ -0,0 +1,10 @@
class AddCropValuesToUsers < ActiveRecord::Migration
def change
# this is a ugly hack and will stay until I find a way to pass parameters
# to the paperclip Sidekiq worker. oh well.
add_column :users, :crop_x, :integer
add_column :users, :crop_y, :integer
add_column :users, :crop_w, :integer
add_column :users, :crop_h, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20141229105013) do
ActiveRecord::Schema.define(version: 20141229133149) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -164,6 +164,10 @@ ActiveRecord::Schema.define(version: 20141229105013) do
t.integer "profile_picture_file_size"
t.datetime "profile_picture_updated_at"
t.boolean "profile_picture_processing"
t.integer "crop_x"
t.integer "crop_y"
t.integer "crop_w"
t.integer "crop_h"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree