Fixed syntax error in image upload request from mangled merge

This commit is contained in:
snipe 2020-04-21 06:29:57 -07:00
parent c38bbfc8bd
commit 29b05d2020
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC

View file

@ -81,7 +81,7 @@ class ImageUploadRequest extends Request
$upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) { $upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) {
$constraint->aspectRatio(); $constraint->aspectRatio();
$constraint->upsize(); $constraint->upsize();
}) });
// This requires a string instead of an object, so we use ($string) // This requires a string instead of an object, so we use ($string)
Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode()); Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode());
@ -117,18 +117,17 @@ class ImageUploadRequest extends Request
// If the user isn't uploading anything new but wants to delete their old image, do so // If the user isn't uploading anything new but wants to delete their old image, do so
} elseif ($this->input('image_delete')=='1') { } elseif ($this->input('image_delete')=='1') {
Storage::disk('public')->delete($path.'/'.$item->{$fieldname});
$item->{$fieldname} = null;
}
try { try {
unlink($path.'/'.$item->image); Storage::disk('public')->delete($path.'/'.$item->{$fieldname});
$item->{$fieldname} = null;
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); \Log::debug($e);
} }
$item->image = null;
} }
return $item; return $item;
} }
} }