質問編集履歴

1

サーバーサイドの処理を行うjsコードを追記しました!

2018/03/28 18:10

投稿

tacro
tacro

スコア23

test CHANGED
File without changes
test CHANGED
@@ -24,6 +24,34 @@
24
24
 
25
25
  #該当のソースコード
26
26
 
27
+ サーバーサイド
28
+
29
+ ```javascript
30
+
31
+ ...
32
+
33
+ $('#_submit').on('click', function(){
34
+
35
+ // crop のデータを取得
36
+
37
+ var data = $('#crop_img').cropper('getData');
38
+
39
+ $("#post_image_x").val(Math.round(data.x));
40
+
41
+ $("#post_image_y").val(Math.round(data.y));
42
+
43
+ $("#post_image_w").val(Math.round(data.width));
44
+
45
+ $("#post_image_h").val(Math.round(data.height));
46
+
47
+ $("#myform").submit();
48
+
49
+ });
50
+
51
+
52
+
53
+ ```
54
+
27
55
  ```Ruby
28
56
 
29
57
  class ItemImageUploader < CarrierWave::Uploader::Base