簡體   English   中英

無法將圖像數據寫入路徑-干預圖像

[英]Can't write image data to path - Intervention Image

我正在嘗試使用laravel項目中的Intervention包來調整圖像大小。 我可以使用Storage Facade來存儲圖像,但是當我將其與Image類一起存儲時,它會拋出以下錯誤。

無法將圖像數據寫入路徑(/var/www/commerce/storage/featureds/2-1537128615.jpg)

if ($request->has("featured_img")) {
    $file_path = $request->get("featured_img");
    $exp = explode("/",$file_path);
    $filename = $exp[1];
    $featured_path = "featureds/".$filename;
    \Storage::copy($request->get("featured_img"), $featured_path);

    \Image::make(\Storage::get($featured_path))->fit(400, 300)->save(storage_path($featured_path));
    $product->media()->where("type", "featured")->update(["path" => $featured_path]);

 }

我怎樣才能解決這個問題 ? 謝謝你的幫助

存儲器中是否有特色目錄?

如果否,則使用mkdir來創建目錄,因為Intervention不會自動創建目錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM