【发布时间】:2021-03-15 23:56:27
【问题描述】:
我正在尝试使用带有 Livewire 的干预图像来减小尺寸,但我没有成功。如果 Livewire 不允许,他们可以指导我或告诉我。
我正在尝试通过这种方法:
foreach ($this->imagenes as $pathGaleria) {
$imgUrl = $pathGaleria->store('imagenesPropiedades');
$img = imgPropiedades::create([
'url' => $imgUrl,
'property_id' => $this->propiedadId
]);
换一种方式:
foreach ($this->imagenes as $pathGaleria) {
$imgUrl = $pathGaleria->store('imagenesPropiedades');
Image::make($pathGaleria)->resize(1200, null, function ($constraint) {
$constraint->aspectRatio();
})
->save($imgUrl);
$img = imgPropiedades::create([
'url' => $imgUrl,
'property_id' => $this->propiedadId
]);
}
但页面仍然空白。谢谢。
【问题讨论】:
标签: laravel file-upload laravel-7 laravel-livewire