現在Laravel5.4を使った掲示板を作成しております。
プロフィール画像を登録するためコントローラーに下記のようにロジックを書いてみたのですが、
returnが思っていたものと異なります。
期待しているreturnはどうすれば得られるでしょうか。
よろしくお願いいたします。
public function createPhoto($params) { $imageData = $params['image']; $imageFileName = Carbon::now()->timestamp . '_' . uniqid() . '.' . explode('/', explode(':', substr($imageData, 0, strpos($imageData, ';')))[1])[1]; $filePath = '/images/' . $imageFileName; // Upload S3 $s3 = Storage::disk('s3'); $s3->put($filePath, file_get_contents($imageData), 'public'); $contents = Storage::url($filePath) return $contents; }
####予想&期待しているreturn
https://s3-ap-northeast-1.amazonaws.com/your-repository-name/images/1495534543037_4h38eb59e10f.jpeg
####実際のreturn
"/storage//images/1495534543037_4h38eb59e10f.jpeg"
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/29 09:07