質問編集履歴
8
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,42 +6,16 @@
|
|
6
6
|

|
7
7
|
|
8
8
|
```view
|
9
|
-
|
9
|
+
<%= form.file_field :images, multiple: true %>
|
10
|
-
<%= file_field_tag 'copy_image' %>
|
11
|
-
<%= file_field_tag 'second_image' %>
|
12
|
-
<%= file_field_tag 'third_image' %>
|
13
|
-
<%= file_field_tag 'fourth_image' %>
|
14
|
-
<%= file_field_tag 'five_image' %>
|
15
10
|
```
|
16
11
|
|
17
|
-
```view
|
18
|
-
<div class="main">
|
19
|
-
<i class="fas fa-chevron-circle-left" aria-hidden="true" id="prev"></i>
|
20
|
-
<img src="<%= @plan.image %>" id="target" style="width: 950px; height: 400px; padding-bottom: 15px; padding-top: 20px; ">
|
21
|
-
<i class="fas fa-chevron-circle-right" aria-hidden="true" id="next"></i>
|
22
|
-
</div>
|
23
|
-
<div class="king">
|
24
|
-
<ul class="example">
|
25
|
-
<li class="current"><img src="<%= @plan.copy_image %>" style=" width: 185px; height: 123px;"></li>
|
26
|
-
<li><img src="<%= @plan.second_image %>" style="width: 185px; height: 123px;"></li>
|
27
|
-
<li><img src="<%= @plan.third_image %>" style="width: 185px; height: 123px;"></li>
|
28
|
-
<li><img src="<%= @plan.fourth_image %>" style="width: 185px; height: 123px;"></li>
|
29
|
-
<li><img src="<%= @plan.five_image %>" style="width: 185px; height: 123px;"></li>
|
30
|
-
</ul>
|
31
|
-
</div>
|
32
|
-
```
|
33
|
-
|
34
12
|
```model
|
13
|
+
class Article < ActiveRecord::Base
|
35
|
-
|
14
|
+
mount_uploaders :images, ImageUploader
|
36
|
-
|
15
|
+
serialize :images, JSON
|
37
|
-
|
16
|
+
end
|
38
|
-
mount_uploader :third_image, ImageUploader
|
39
|
-
mount_uploader :fourth_image, ImageUploader
|
40
|
-
mount_uploader :five_image, ImageUploader
|
41
17
|
```
|
42
18
|
|
43
19
|
```controller
|
44
|
-
|
45
|
-
Plan.create(place: params[:place], image: params[:image], copy_image: params[:copy_image], second_image: params[:second_image], third_image: params[:third_image], fourth_image: params[:fourth_image], five_image: params[:five_image], title: params[:title], contents: params[:contents], times: params[:times], datetimes: params[:datetimes], guider_id: current_guider.id)
|
46
|
-
end
|
20
|
+
params.require(:article).permit(:title, :body, {images: []})
|
47
21
|
```
|
7
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
複数の画像を一つのファイルでアップロードしたいが、できない状態になってます。
|
1
|
+
複数の画像を一つのファイル選択ダイアログでアップロードしたいが、できない状態になってます。
|
body
CHANGED
File without changes
|
6
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
今、一つのファイルで複数画像をアップロードしようと考えています。しかし、複数画像をファイル一つに保存し、viewで出すことがまだできていません。どうぞ教えていただきたら、嬉しいです。
|
2
2
|
|
3
|
+
複数
|
3
4
|

|
5
|
+
1つ
|
6
|
+

|
4
7
|
|
5
8
|
```view
|
6
9
|
<%= file_field_tag 'image' %>
|
5
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
複数の画像を一つのファイルでアップロードしたいが、
|
1
|
+
複数の画像を一つのファイルでアップロードしたいが、できない状態になってます。
|
body
CHANGED
File without changes
|
4
変更
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
3
変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
|
5
|
-
```view
|
5
|
+
```view
|
6
6
|
<%= file_field_tag 'image' %>
|
7
7
|
<%= file_field_tag 'copy_image' %>
|
8
8
|
<%= file_field_tag 'second_image' %>
|
@@ -11,22 +11,7 @@
|
|
11
11
|
<%= file_field_tag 'five_image' %>
|
12
12
|
```
|
13
13
|
|
14
|
-
```
|
15
|
-
mount_uploader :image, ImageUploader
|
16
|
-
mount_uploader :copy_image, ImageUploader
|
17
|
-
mount_uploader :second_image, ImageUploader
|
18
|
-
mount_uploader :third_image, ImageUploader
|
19
|
-
mount_uploader :fourth_image, ImageUploader
|
20
|
-
mount_uploader :five_image, ImageUploader
|
21
|
-
```
|
22
|
-
|
23
|
-
```controller
|
24
|
-
def create
|
25
|
-
Plan.create(place: params[:place], image: params[:image], copy_image: params[:copy_image], second_image: params[:second_image], third_image: params[:third_image], fourth_image: params[:fourth_image], five_image: params[:five_image], title: params[:title], contents: params[:contents], times: params[:times], datetimes: params[:datetimes], guider_id: current_guider.id)
|
26
|
-
end
|
27
|
-
```
|
28
|
-
|
29
|
-
```view show
|
14
|
+
```view
|
30
15
|
<div class="main">
|
31
16
|
<i class="fas fa-chevron-circle-left" aria-hidden="true" id="prev"></i>
|
32
17
|
<img src="<%= @plan.image %>" id="target" style="width: 950px; height: 400px; padding-bottom: 15px; padding-top: 20px; ">
|
@@ -41,4 +26,19 @@
|
|
41
26
|
<li><img src="<%= @plan.five_image %>" style="width: 185px; height: 123px;"></li>
|
42
27
|
</ul>
|
43
28
|
</div>
|
29
|
+
```
|
30
|
+
|
31
|
+
```model
|
32
|
+
mount_uploader :image, ImageUploader
|
33
|
+
mount_uploader :copy_image, ImageUploader
|
34
|
+
mount_uploader :second_image, ImageUploader
|
35
|
+
mount_uploader :third_image, ImageUploader
|
36
|
+
mount_uploader :fourth_image, ImageUploader
|
37
|
+
mount_uploader :five_image, ImageUploader
|
38
|
+
```
|
39
|
+
|
40
|
+
```controller
|
41
|
+
def create
|
42
|
+
Plan.create(place: params[:place], image: params[:image], copy_image: params[:copy_image], second_image: params[:second_image], third_image: params[:third_image], fourth_image: params[:fourth_image], five_image: params[:five_image], title: params[:title], contents: params[:contents], times: params[:times], datetimes: params[:datetimes], guider_id: current_guider.id)
|
43
|
+
end
|
44
44
|
```
|
2
修正確認
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
1
修正確認
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
複数の画像を一つのファイルで
|
1
|
+
複数の画像を一つのファイルでアップロードしたいが、、
|
body
CHANGED
File without changes
|