修复 placeholder 被删除报错
This commit is contained in:
parent
14be551526
commit
77b3167d36
|
|
@ -68,6 +68,10 @@ class ImageService
|
||||||
public function resize(int $width = 100, int $height = 100): string
|
public function resize(int $width = 100, int $height = 100): string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
if (!file_exists($this->imagePath)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$extension = pathinfo($this->imagePath, PATHINFO_EXTENSION);
|
$extension = pathinfo($this->imagePath, PATHINFO_EXTENSION);
|
||||||
$newImage = 'cache/' . mb_substr($this->image, 0, mb_strrpos($this->image, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
|
$newImage = 'cache/' . mb_substr($this->image, 0, mb_strrpos($this->image, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue