Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Apr 22, 2024
2 parents 7f38ca2 + cfe39af commit 5229dd6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/AssetModelsFilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function store(UploadFileRequest $request, $modelId = null)

$file_name = $request->handleFile('private_uploads/assetmodels/','model-'.$model->id,$file);

$model->logUpload($file_name, e($request->get('notes')));
$model->logUpload($file_name, $request->get('notes'));
}

return redirect()->back()->with('success', trans('general.file_upload_success'));
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Assets/AssetFilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function store(UploadFileRequest $request, $assetId = null)
foreach ($request->file('file') as $file) {
$file_name = $request->handleFile('private_uploads/assets/','hardware-'.$asset->id, $file);

$asset->logUpload($file_name, e($request->get('notes')));
$asset->logUpload($file_name, $request->get('notes'));
}

return redirect()->back()->with('success', trans('admin/hardware/message.upload.success'));
Expand Down
7 changes: 4 additions & 3 deletions app/Http/Requests/ImageUploadRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function rules()
return [
'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp,avif',
'avatar' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp,avif',
'favicon' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp,image/x-icon,image/vnd.microsoft.icon,ico',
];
}

Expand Down Expand Up @@ -103,9 +104,9 @@ public function handleImages($item, $w = 600, $form_fieldname = 'image', $path =
\Log::info('File name will be: '.$file_name);
\Log::debug('File extension is: '.$ext);

if (($image->getMimeType() == 'image/avif') || ($image->getMimeType() == 'image/webp')) {
// If the file is a webp or avif, we need to just move it since webp support
// needs to be compiled into gd for resizing to be available
if (($image->getMimeType() == 'image/vnd.microsoft.icon') || ($image->getMimeType() == 'image/x-icon') || ($image->getMimeType() == 'image/avif') || ($image->getMimeType() == 'image/webp')) {
// If the file is an icon, webp or avif, we need to just move it since gd doesn't support resizing
// icons or avif, and webp support and needs to be compiled into gd for resizing to be available
Storage::disk('public')->put($path.'/'.$file_name, file_get_contents($image));

} elseif($image->getMimeType() == 'image/svg+xml') {
Expand Down

0 comments on commit 5229dd6

Please sign in to comment.