Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
533 changes: 532 additions & 1 deletion public/css/dropzone.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/LaravelFilemanagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function boot()
$this->publishes([
__DIR__.'/Handlers/LfmConfigHandler.php' => base_path('app/Handlers/LfmConfigHandler.php'),
], 'lfm_handler');

if(config('lfm.use_package_routes')) {
\UniSharp\LaravelFilemanager\Lfm::routes();
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Lfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ public static function routes()
{
$middleware = [ CreateDefaultFolder::class, MultiUser::class ];
$as = 'unisharp.lfm.';
$prefix = config('lfm.url_prefix');

Route::group(compact('middleware', 'as'), function () {
Route::group(compact('middleware', 'as', 'prefix'), function () {
$namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\';

// display main layout
Expand Down
2 changes: 1 addition & 1 deletion src/LfmPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private function uploadValidator($file)

$new_file_name = $this->getNewName($file);

if ($this->setName($new_file_name)->exists()) {
if ($this->setName($new_file_name)->exists() && !config('lfm.over_write_on_duplicate')) {
return $this->error('file-exist');
}

Expand Down
80 changes: 46 additions & 34 deletions src/config/lfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,59 @@
|--------------------------------------------------------------------------
| online => http://unisharp.github.io/laravel-filemanager/config
| offline => vendor/unisharp/laravel-filemanager/docs/config.md
*/
*/

return [
/*
|--------------------------------------------------------------------------
| Routing
|--------------------------------------------------------------------------
*/
*/

'use_package_routes' => true,
'use_package_routes' => true,

'middlewares' => ['web', 'auth'],
'middlewares' => ['web', 'auth'],

// The url to this package. Change it if necessary.
'url_prefix' => 'laravel-filemanager',
'url_prefix' => 'laravel-filemanager',

// Use relative paths (without domain)
'relative_paths' => false,
'relative_paths' => false,

// behavior on files with identical name
// setting it to true cause old file replace with new one
// setting it to false show `error-file-exist` error and stop upload
'over_write_on_duplicate' => false,

/*
|--------------------------------------------------------------------------
| Multi-User Mode
|--------------------------------------------------------------------------
*/
*/

'allow_multi_user' => true,
'allow_multi_user' => true,

'allow_share_folder' => true,
'allow_share_folder' => true,

/*
|--------------------------------------------------------------------------
| Folder Names
|--------------------------------------------------------------------------
*/
*/

// Flexible way to customize client folders accessibility
// If you want to customize client folders, publish tag="lfm_handler"
// Then you can rewrite userField function in App\Handler\ConfigHandler class
// And set 'user_field' to App\Handler\ConfigHandler::class
// Ex: The private folder of user will be named as the user id.
'user_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class,
'user_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class,

'shared_folder_name' => 'shares',
'shared_folder_name' => 'shares',

'thumb_folder_name' => 'thumbs',
'thumb_folder_name' => 'thumbs',

'folder_categories' => [
'file' => [
'folder_categories' => [
'file' => [
'folder_name' => 'files',
'startup_view' => 'grid',
'max_size' => 50000,
Expand Down Expand Up @@ -85,56 +90,63 @@
|--------------------------------------------------------------------------
| Upload / Validation
|--------------------------------------------------------------------------
*/
*/

'disk' => 'public',
'disk' => 'public',

'rename_file' => false,
'rename_file' => false,

'alphanumeric_filename' => false,
'alphanumeric_filename' => false,

'alphanumeric_directory' => false,
'alphanumeric_directory' => false,

'should_validate_size' => false,
'should_validate_size' => false,

'should_validate_mime' => false,
'should_validate_mime' => false,

// permissions to be set when create a new folder or when it creates automatically with thumbnails
'create_folder_mode' => 0755,
'create_folder_mode' => 0755,

// permissions to be set on file upload.
'create_file_mode' => 0644,
'create_file_mode' => 0644,

// If true, it will attempt to chmod the file after upload
'should_change_file_mode' => true,
'should_change_file_mode' => true,

/*
|--------------------------------------------------------------------------
| Thumbnail
|--------------------------------------------------------------------------
*/
*/

// If true, image thumbnails would be created during upload
'should_create_thumbnails' => true,

// Create thumbnails automatically only for listed types.
'raster_mimetypes' => [
'raster_mimetypes' => [
'image/jpeg',
'image/pjpeg',
'image/png',
],
/*
|--------------------------------------------------------------------------
| jQuery UI options
|--------------------------------------------------------------------------
*/
'resize_aspectRatio' => false,
'resize_containment' => true,

'thumb_img_width' => 200,
'thumb_img_width' => 200,

'thumb_img_height' => 200,
'thumb_img_height' => 200,

/*
|--------------------------------------------------------------------------
| File Extension Information
|--------------------------------------------------------------------------
*/
*/

'file_type_array' => [
'file_type_array' => [
'pdf' => 'Adobe Acrobat',
'doc' => 'Microsoft Word',
'docx' => 'Microsoft Word',
Expand All @@ -149,7 +161,7 @@
'pptx' => 'Microsoft PowerPoint',
],

'file_icon_array' => [
'file_icon_array' => [
'pdf' => 'fa-file-pdf-o',
'doc' => 'fa-file-word-o',
'docx' => 'fa-file-word-o',
Expand All @@ -174,8 +186,8 @@
|
| Please note that the 'upload_max_filesize' & 'post_max_size'
| directives are not supported.
*/
'php_ini_overrides' => [
*/
'php_ini_overrides' => [
'memory_limit' => '256M',
],
];
18 changes: 8 additions & 10 deletions src/views/crop.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<div class="row">
<div class="row pt-5">
<div class="col-md-8">
<div class="crop-container">
<img src="{{ $img->url . '?timestamp=' . $img->time }}" class="img img-responsive">
</div>
</div>
<div class="col-md-4">
<div class="text-center">

<div class="img-preview center-block"></div>
<br>

<div class="btn-group clearfix">
<label class="btn btn-primary btn-aspectRatio active" onclick="changeAspectRatio(this, 16 / 9)">
16:9
Expand All @@ -23,16 +21,17 @@
<label class="btn btn-primary btn-aspectRatio" onclick="changeAspectRatio(this, 2 / 3)">
2:3
</label>
{{--<label class="btn btn-primary" onclick="changeAspectRatio(this, null)">
<label class="btn btn-primary btn-aspectRatio" onclick="changeAspectRatio(this, null)">
Free
</label>--}}
</label>
</div>
<br>
<br>

<button class="btn btn-primary" onclick="performCrop()">{{ trans('laravel-filemanager::lfm.btn-crop') }}</button>
<button class="btn btn-primary" onclick="performCropNew()">{{ trans('laravel-filemanager::lfm.btn-copy-crop') }}</button>
<button class="btn btn-info" onclick="loadItems()">{{ trans('laravel-filemanager::lfm.btn-cancel') }}</button>
<div class="btn-group clearfix">
<button class="btn btn-warning" onclick="performCrop()">{{ trans('laravel-filemanager::lfm.btn-crop') }}</button>
<button class="btn btn-info" onclick="performCropNew()">{{ trans('laravel-filemanager::lfm.btn-copy-crop') }}</button>
<button class="btn btn-default" onclick="loadItems()">{{ trans('laravel-filemanager::lfm.btn-cancel') }}</button>
</div>
<form id='cropForm'>
<input type="hidden" id="img" name="img" value="{{ $img->name }}">
<input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
Expand All @@ -44,7 +43,6 @@
</form>
</div>
</div>

</div>

<script>
Expand Down
84 changes: 41 additions & 43 deletions src/views/resize.blade.php
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
<div class="row">
<div class="col-md-8" id="containment">
<img id="resize" src="{{ $img->url . '?timestamp=' . $img->time }}" height="{{ $height }}" width="{{ $width }}">
</div>
<div class="col-md-4">

<table class="table table-compact table-striped">
<thead></thead>
<tbody>
@if ($scaled)
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-ratio') }}</td>
<td>{{ number_format($ratio, 2) }}</td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-scaled') }}</td>
<td>
{{ trans('laravel-filemanager::lfm.resize-true') }}
</td>
</tr>
@endif
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-old-height') }}</td>
<td>{{ $original_height }}px</td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-old-width') }}</td>
<td>{{ $original_width }}px</td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-new-height') }}</td>
<td><span id="height_display"></span></td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-new-width') }}</td>
<td><span id="width_display"></span></td>
</tr>
</tbody>
<div class="row pt-5">
<div class="col-md-8" id="containment">
<img id="resize" src="{{ $img->url . '?timestamp=' . $img->time }}" height="{{ $height }}" width="{{ $width }}">
</div>
<div class="col-md-4">
<table class="table table-compact table-striped">
<thead></thead>
<tbody>
@if ($scaled)
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-ratio') }}</td>
<td>{{ number_format($ratio, 2) }}</td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-scaled') }}</td>
<td>
{{ trans('laravel-filemanager::lfm.resize-true') }}
</td>
</tr>
@endif
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-old-height') }}</td>
<td>{{ $original_height }}px</td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-old-width') }}</td>
<td>{{ $original_width }}px</td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-new-height') }}</td>
<td><span id="height_display"></span></td>
</tr>
<tr>
<td>{{ trans('laravel-filemanager::lfm.resize-new-width') }}</td>
<td><span id="width_display"></span></td>
</tr>
</tbody>
</table>

<button class="btn btn-primary" onclick="doResize()">{{ trans('laravel-filemanager::lfm.btn-resize') }}</button>
<button class="btn btn-info" onclick="loadItems()">{{ trans('laravel-filemanager::lfm.btn-cancel') }}</button>

<input type="hidden" id="img" name="img" value="{{ $img->name }}">
<input type="hidden" name="ratio" value="{{ $ratio }}"><br>
<input type="hidden" name="scaled" value="{{ $scaled }}"><br>
<input type="hidden" id="original_height" name="original_height" value="{{ $original_height }}"><br>
<input type="hidden" id="original_width" name="original_width" value="{{ $original_width }}"><br>
<input type="hidden" id="height" name="height" value="{{ $height }}"><br>
<input type="hidden" id="width" name="width" value="{{ $width }}">

</div>
</div>
</div>

<script>
Expand All @@ -58,8 +54,10 @@
$("#width_display").html($("#resize").width() + "px");

$("#resize").resizable({
aspectRatio: true,
aspectRatio: {{ config('lfm.resize_aspectRatio')?'true':'false' }},
@if(config('lfm.resize_containment'))
containment: "#containment",
@endif
handles: "n, e, s, w, se, sw, ne, nw",
resize: function (event, ui) {
$("#width").val($("#resize").width());
Expand Down