Laracast13's avatar

Encoding format (jfif) is not supported - Laravel

Hello

I used Intervention image plugin, everything worked. uploading files but one day is stop working and when trying upload it gives error.

This is in log Intervention\Image\Exception\NotSupportedException: Encoding format (jfif) is not supported.

This my function

public function photoUploads(Request $request)
{


    $year_folder = date("Y");
    $month_folder = date("m");
    $path_year = "uploads/cars/".$year_folder;   
    $path_month = $path_year."/".$month_folder."/";       
    if(!File::exists($path_year)) {
        File::makeDirectory($path_year, 0775, true);
    }
    if(!File::exists($path_month)) {
        File::makeDirectory($path_month, 0775, true);
    }
    $path = $path_month;

 if($request->hasFile('auctionImage')){         
    $auctionImages = $request->file('auctionImage');     
       foreach ($auctionImages as $auctionImage) {
            $auctionName = hexdec(uniqid()).'.'.$auctionImage->getClientOriginalExtension(); 
            Image::make($auctionImage)->resize(1200, 1200, function ($constraint) {$constraint->aspectRatio();$constraint->upsize();})->save($path.$auctionName);
            $auctionUrl = $path . $auctionName;
            return $auctionUrl;
        }
 }

0 likes
2 replies
Laracast13's avatar

Change

getClientOriginalExtension() to extension() and it worked

Please or to participate in this conversation.