2016-07-16 5 views
1

grabzit 라이브러리를 사용하여 Laravels IoC 컨테이너를 사용하여 비디오를 gif로 변환하고 있습니다.storage_path가 'app/..'디렉토리를 반환하는 이유

namespace App\Services; 

use App\Contracts\VideoToGif; 
use App\Clients\GrabzIt\GrabzItClient; 

class GrabzitService implements VideoToGif { 

... 


public function save(array $input) 
{ 

    try { 

     $id = $input["id"]; 

     $filename = $input["filename"]; 

     $result = $this->client->GetResult($id); 

     $destinationPath = storage_path('media/gifs'); 

     file_put_contents($destinationPath . "/" . $filename, $result); 

    } catch (Exception $e) { 
     throw $e; 
    } 
} 

는하지만이 오류가 발생합니다 :

ErrorException: file_put_contents(/app/storage/media/gifs/converted_file.gif): failed to open stream: No such file or directory in /app/app/Services/GrabzitService.php:65 

확실하지 storage_path() 경우 앱 디렉토리를 반환한다고 가정 할 때 그것의 실제 프로젝트 루트입니다.

내가 뭘 잘못하고 있니?

내 프로젝트는 Heroku가에

답변

0

storage_path()/스토리지 디렉토리를 반환하고 미디어 콘텐츠를 넣어 장소로 생각하지입니다. 대신 storage_path ('미디어/GIF를')가 반환/저장/미디어/GIF를

, 공용 디렉토리에 미디어를 저장해야합니다 (public_path())

+0

이유 storage_path 그래도 올바른 경로를 반환하지 않습니다 :/응용 프로그램/storage <- 사실 앱 폴더 밖에있을 때. –

+0

디렉토리 구조를 변경 했습니까? –

+0

아니요, 모든 것이 재고입니다. –

관련 문제