->当我使用“ spatie / laravel-image-optimizer”在laravel中对大于4 MB的大图像进行升级时:“ ^ 1.3”,包装错误
错误:
InvalidArgumentException ``不存在 vendor \ spatie \ image-optimizer \ src \ Image.php
使用InvalidArgumentException;
类图片 { 保护$ pathToImage ='';
public function __construct(string $pathToImage)
{
if (! file_exists($pathToImage)) {
throw new InvalidArgumentException("`{$pathToImage}` does not exist");
}
$this->pathToImage = $pathToImage;
}
public function mime(): string
{
return mime_content_type($this->pathToImage);
}
public function path(): string
{
return $this->pathToImage;
}