mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
format
This commit is contained in:
@@ -29,7 +29,6 @@ return [
|
||||
],
|
||||
|
||||
'image_sizes' => [
|
||||
|
||||
'immediately' => [
|
||||
[
|
||||
'size' => 120,
|
||||
@@ -54,8 +53,6 @@ return [
|
||||
'size' => 1440,
|
||||
'name' => 'xl',
|
||||
],
|
||||
|
||||
]
|
||||
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -20,7 +20,7 @@ class UserStorageResource extends JsonResource
|
||||
|
||||
$totalCapacity = match (get_settings('subscription_type')) {
|
||||
'metered' => $this->usedCapacity / 1000000000,
|
||||
'fixed' => $this->limitations->max_storage_amount,
|
||||
'fixed' => $this->limitations->max_storage_amount,
|
||||
};
|
||||
|
||||
return [
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Files\Actions;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -22,9 +21,7 @@ class GenerateImageThumbnailAction
|
||||
|
||||
collect(config("vuefilemanager.image_sizes.$execution"))
|
||||
->each(function ($size) use ($image, $userId, $fileName, $imageWidth) {
|
||||
|
||||
if ($imageWidth > $size['size']) {
|
||||
|
||||
// Create intervention image
|
||||
$intervention = Image::make($image)->orientate();
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@ namespace Domain\Files\Actions;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
|
||||
class ProcessImageThumbnailAction
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
public GenerateImageThumbnailAction $generateImageThumbnail,
|
||||
) {}
|
||||
@@ -27,10 +25,8 @@ class ProcessImageThumbnailAction
|
||||
$file,
|
||||
string $userId
|
||||
): void {
|
||||
|
||||
// Create thumbnail from image
|
||||
if (in_array($file->getClientMimeType(), $this->availableFormats)) {
|
||||
|
||||
// Make copy of file for the thumbnail generation
|
||||
Storage::disk('local')->copy("files/$userId/{$fileName}", "temp/$userId/{$fileName}");
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@ use App\Users\Actions\CheckStorageCapacityAction;
|
||||
class UploadFileAction
|
||||
{
|
||||
public function __construct(
|
||||
public RecordUploadAction $recordUpload,
|
||||
public CheckStorageCapacityAction $checkStorageCapacity,
|
||||
public ProcessImageThumbnailAction $createImageThumbnail,
|
||||
public RecordUploadAction $recordUpload,
|
||||
public CheckStorageCapacityAction $checkStorageCapacity,
|
||||
public ProcessImageThumbnailAction $createImageThumbnail,
|
||||
public MoveFileToExternalStorageAction $moveFileToExternalStorage,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Upload new file
|
||||
@@ -69,7 +68,6 @@ class UploadFileAction
|
||||
// Check if user has enough space to upload file
|
||||
($this->checkStorageCapacity)($user_id, $fileSize, $chunkName);
|
||||
|
||||
|
||||
// Move finished file from chunk to file-manager directory
|
||||
$disk_local->move("chunks/$chunkName", "files/$user_id/$fileName");
|
||||
|
||||
|
||||
@@ -39,16 +39,14 @@ class DumpTrashController extends Controller
|
||||
|
||||
// Delete thumbnail if exist
|
||||
if ($file->thumbnail) {
|
||||
|
||||
collect([
|
||||
config('vuefilemanager.image_sizes.later'),
|
||||
config('vuefilemanager.image_sizes.immediately'),
|
||||
])->collapse()
|
||||
->each(function ($size) use ($file) {
|
||||
|
||||
Storage::delete("/files/$file->user_id/{$size['name']}-{$file->basename}");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Delete file permanently
|
||||
$file->forceDelete();
|
||||
|
||||
@@ -602,10 +602,10 @@ if (! function_exists('get_thumbnail_file_list')) {
|
||||
function get_thumbnail_file_list(string $basename): Collection
|
||||
{
|
||||
return collect([
|
||||
config('vuefilemanager.image_sizes.later'),
|
||||
config('vuefilemanager.image_sizes.immediately'),
|
||||
])->collapse()
|
||||
->map(fn ($item) => $item['name'] . '-' . $basename);
|
||||
config('vuefilemanager.image_sizes.later'),
|
||||
config('vuefilemanager.image_sizes.immediately'),
|
||||
])->collapse()
|
||||
->map(fn ($item) => $item['name'] . '-' . $basename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class FileTest extends TestCase
|
||||
])
|
||||
->collapse()
|
||||
->each(
|
||||
fn($item) => $disk->assertExists(
|
||||
fn ($item) => $disk->assertExists(
|
||||
"files/{$user->id}/{$item['name']}-{$file->basename}"
|
||||
)
|
||||
);
|
||||
|
||||
@@ -115,11 +115,10 @@ class TrashTest extends TestCase
|
||||
"files/$user->id/fake-image.jpg"
|
||||
);
|
||||
|
||||
foreach($thumbnail_sizes as $size) {
|
||||
foreach ($thumbnail_sizes as $size) {
|
||||
$disk->assertMissing(
|
||||
"files/$user->id/{$size['name']}-fake-image.jpg"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user