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