mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Revert "Handle image_source with ConvertBase64ToFiles"
This reverts commit 168d7f7004
.
This commit is contained in:
parent
a76b36cad9
commit
f24138da44
|
@ -437,6 +437,22 @@ class AssetsController extends Controller
|
||||||
$asset->rtd_location_id = $request->get('rtd_location_id', null);
|
$asset->rtd_location_id = $request->get('rtd_location_id', null);
|
||||||
$asset->location_id = $request->get('rtd_location_id', null);
|
$asset->location_id = $request->get('rtd_location_id', null);
|
||||||
|
|
||||||
|
if ($request->has('image_source') && $request->input('image_source') != "") {
|
||||||
|
$saved_image_path = Helper::processUploadedImage(
|
||||||
|
$request->input('image_source'), 'uploads/assets/'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$saved_image_path) {
|
||||||
|
return response()->json(Helper::formatStandardApiResponse(
|
||||||
|
'error',
|
||||||
|
null,
|
||||||
|
trans('admin/hardware/message.create.error')
|
||||||
|
), 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset->image = $saved_image_path;
|
||||||
|
}
|
||||||
|
|
||||||
$asset = $request->handleImages($asset);
|
$asset = $request->handleImages($asset);
|
||||||
|
|
||||||
// Update custom fields in the database.
|
// Update custom fields in the database.
|
||||||
|
@ -518,8 +534,31 @@ class AssetsController extends Controller
|
||||||
($request->filled('company_id')) ?
|
($request->filled('company_id')) ?
|
||||||
$asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : '';
|
$asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : '';
|
||||||
|
|
||||||
|
($request->filled('rtd_location_id')) ?
|
||||||
|
$asset->location_id = $request->get('rtd_location_id') : null;
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->filled('image_source')) {
|
||||||
|
if ($request->input('image_source') == "") {
|
||||||
($request->filled('rtd_location_id')) ?
|
($request->filled('rtd_location_id')) ?
|
||||||
$asset->location_id = $request->get('rtd_location_id') : null;
|
$asset->location_id = $request->get('rtd_location_id') : null;
|
||||||
|
$asset->image = null;
|
||||||
|
} else {
|
||||||
|
$saved_image_path = Helper::processUploadedImage(
|
||||||
|
$request->input('image_source'), 'uploads/assets/'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$saved_image_path) {
|
||||||
|
return response()->json(Helper::formatStandardApiResponse(
|
||||||
|
'error',
|
||||||
|
null,
|
||||||
|
trans('admin/hardware/message.update.error')
|
||||||
|
), 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset->image = $saved_image_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$asset = $request->handleImages($asset);
|
$asset = $request->handleImages($asset);
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,8 @@ class ImageUploadRequest extends Request
|
||||||
*/
|
*/
|
||||||
protected function base64FileKeys(): array
|
protected function base64FileKeys(): array
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* image_source is here just legacy reasons. Api\AssetController
|
|
||||||
* had it once to allow encoded image uploads.
|
|
||||||
*/
|
|
||||||
return [
|
return [
|
||||||
'image' => 'auto',
|
'image' => 'auto',
|
||||||
'image_source' => 'auto'
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue