当我尝试使用具有laravel的干预图像库来保存图像时,它可以工作,但是缺少扩展 .
当我死了并转储Image :: make()方法的输出时,我得到这个:
object(Intervention\Image\Image)[304]
public 'resource' => resource(9, gd)
public 'type' => int 2
public 'width' => int 480
public 'height' => int 640
public 'dirname' => string '/tmp' (length=4)
public 'basename' => string 'phpJHlKbK' (length=9)
public 'extension' => null
public 'filename' => string 'phpJHlKbK' (length=9)
public 'mime' => string 'image/jpeg' (length=10)
protected 'original' => null
public 'encoded' => null
正在上传的文件有扩展名但我无法访问它,因为它认为不存在 . 有任何想法吗?
2 回答
干预图像文档说:
所以建议使用'mime'来表示'未知'的方法可能是Raw post数据图像文件:
当您使用PHP上传文件时,它们会重命名为
/tmp/phpJHlKbK
,因此没有可用的扩展名 .但是,如果没有可用的扩展名,Intervention Image 2.0(上周发布)将检查MIME类型,同时保存 .