質問編集履歴

2

エラーの内容を追記しました

2019/07/15 04:51

投稿

hidepon
hidepon

スコア206

test CHANGED
File without changes
test CHANGED
@@ -26,6 +26,10 @@
26
26
 
27
27
  namespace App\Http\Controllers\Homepage;
28
28
 
29
+ //ご指摘をうけて追記
30
+
31
+ use Intervention\Image\Facades\Image;
32
+
29
33
  use Illuminate\Http\Request;
30
34
 
31
35
  use App\Http\Controllers\Controller;
@@ -40,11 +44,11 @@
40
44
 
41
45
  {
42
46
 
43
- $path = storage_path('public/image/org.jpg');
47
+     //ご指摘をうけて変更
44
48
 
45
- $img = Image::make($path);
49
+ $img = Image::make("image/org.jpg")->orientate();
46
50
 
47
- $img->orientate($img);
51
+ $img->save("image/org.jpg");
48
52
 
49
53
  return view('homepage.works');
50
54
 
@@ -59,3 +63,35 @@
59
63
 
60
64
 
61
65
  何か不足している情報があるでしょうか?
66
+
67
+
68
+
69
+ (追記)
70
+
71
+ use Intervention\Image\Facades\Image;
72
+
73
+ を追記
74
+
75
+ $img = Image::make("image/org.jpg")->orientate();
76
+
77
+ としたところ、エラーが消えました
78
+
79
+ $img->save("image/org.jpg");
80
+
81
+ としたのですが。
82
+
83
+
84
+
85
+ Can't write image data to path (image/org.jpg)
86
+
87
+ というエラーメッセージが表示されます。
88
+
89
+ public/image
90
+
91
+ には777でパーミッションを設定しています。
92
+
93
+ ディレクトリの所有者はapacheにしています。
94
+
95
+ 何が原因でしょうか?
96
+
97
+ よろしくお願いいたします。

1

誤記があったので内容を修正しました。

2019/07/15 04:51

投稿

hidepon
hidepon

スコア206

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  $img = Image::make($path);
46
46
 
47
- $img->orientate($path);
47
+ $img->orientate($img);
48
48
 
49
49
  return view('homepage.works');
50
50