jasekz / laradrop Goto Github PK
View Code? Open in Web Editor NEWFile manager using Dropzone.js for Laravel 5.3 - 8.x - PHP
License: MIT License
File manager using Dropzone.js for Laravel 5.3 - 8.x - PHP
License: MIT License
Hey Zig, Zig here :)
Could you advise me on how to have a specific folder loaded into the containers.
I've looked through laradrop.js but cannot find my way in there so well.
Also, browser inspectors show no event lisetner bound to the folder image (the image you click to show the images inside.)
I'd like to be able to offer a link so that the containers load a specific folder - meaning the images inside the folder, as if the folder had been clicked to view the contents.
I apologise if this is a trivial matter, I just figured you are helpfull and are in the best poition to give advice on this.
Thanks :)
Hello,
On the live demo, the upload progress bar seems to be consistent with the upload progress of the file, however, on my setup, the progress bar extends to the end immediately the "start upload" button is clicked.
I followed the instructions on the repo.
Please is there any extra settings to be made to show the actual progress of the file upload?
Adding this package via composer throws the following error.
Declaration of Jasekz\Laradrop\LaradropServiceProvider::boot(Illuminate\Contracts\Events\Dispatcher $events) should be compatible with Illuminate\Foundation\Support\Providers\EventServiceProvider::boot()
I have installed laradrop into a 5.1 laravel ongoing project, but when ever i try to load the dropzone, system gives me this error on browser console.
/laradrop/containers not found.
can you help me on this?.
Laradrop does not support baum/baum v2 which working with Laravel 5.8
https://packagist.org/packages/baum/baum#v2.x-dev
I have made a new controller like this
<?php
use Jasekz\Laradrop\Http\Controllers\LaradropController;
use Input, Auth;
class UserMediaController extends LaradropController {
/**
* Upload and store new file.
*
* @return JsonResponse
*/
public function store()
{
try {
if (! Request::hasFile('file')) {
throw new Exception(trans('err.fileNotProvided'));
}
if( ! Request::file('file')->isValid()) {
throw new Exception(trans('err.invalidFile'));
}
/*
* move file to temp location
*/
$fileExt = Input::file('file')->getClientOriginalExtension();
$fileName = str_replace('.' . $fileExt, '', Input::file('file')->getClientOriginalName()) . '-' . date('Ymdhis');
$mimeType = Request::file('file')->getMimeType();
$tmpStorage = storage_path();
$movedFileName = $fileName . '.' . $fileExt;
$fileSize = Input::file('file')->getSize();
if($fileSize > ( (int) config('laradrop.max_upload_size') * 1000000) ) {
throw new Exception(trans('err.invalidFileSize'));
}
Request::file('file')->move($tmpStorage, $movedFileName);
$disk = Storage::disk(config('laradrop.disk'));
/*
* create thumbnail if needed
*/
$fileData['has_thumbnail'] = 0;
if ($fileSize <= ( (int) config('laradrop.max_thumbnail_size') * 1000000) && in_array($fileExt, ['jpg', 'jpeg', 'png', 'gif'])) {
$thumbDims = config('laradrop.thumb_dimensions');
$img = Image::make($tmpStorage . '/' . $movedFileName);
$img->resize($thumbDims['width'], $thumbDims['height']);
$img->save($tmpStorage . '/_thumb_' . $movedFileName);
// move thumbnail to final location
$disk->put('_thumb_' . $movedFileName, fopen($tmpStorage . '/_thumb_' . $movedFileName, 'r+'));
File::delete($tmpStorage . '/_thumb_' . $movedFileName);
$fileData['has_thumbnail'] = 1;
}
/*
* move uploaded file to final location
*/
$disk->put($movedFileName, fopen($tmpStorage . '/' . $movedFileName, 'r+'));
File::delete($tmpStorage . '/' . $movedFileName);
/*
* save in db
*/
if (!Auth::user()->currentTeam()){
$eitherTeamOrUser = \Auth::user()->finduser;
}
elseif(Auth::user()->currentTeam()){
$eitherTeamOrUser = \Auth::user()->currentTeam()->findteam;
}
$fileData['findimage'] = 1;
$fileData['filename'] = $movedFileName;
$fileData['alias'] = Input::file('file')->getClientOriginalName();
$fileData['public_resource_url'] = config('laradrop.disk_public_url') . '/' . $movedFileName;
$fileData['type'] = $fileExt;
if(Input::get('pid') > 0) {
$fileData['parent_id'] = Input::get('pid');
}
$meta = $disk->getDriver()->getAdapter()->getMetaData($movedFileName);
$meta['disk'] = config('laradrop.disk');
$fileData['meta'] = json_encode($meta);
$file = $this->file->create($fileData);
/*
* fire 'file uploaded' event
*/
event(new FileWasUploaded([
'file' => $file,
'postData' => Input::all()
]));
return $file;
}
catch (Exception $e) {
// delete the file(s)
if( isset($disk) && $disk) {
$disk->delete($movedFileName);
$disk->delete('_thumb_' . $movedFileName);
}
return $this->handleError($e);
}
}
}
Basically, I am trying to override the store method to add a findimage column in the DB. I have altered the migration made the above controller. I cannot get Auth::user() it always returns null if I make it directly in the laradropController, So I am trying to override it to have that function available to me.
if (!Auth::user()->currentTeam()){
$eitherTeamOrUser = \Auth::user()->finduser;
}
elseif(Auth::user()->currentTeam()){
$eitherTeamOrUser = \Auth::user()->currentTeam()->findteam;
}
$fileData['findimage'] = 1;
But this does not overwrite the laradropsController.
I have added these routes
//User Media Files
Route::get('mediaIndex', 'UserMediaController@index');
Route::post('mediaStore', 'UserMediaController@store');
Route::post('mediaDestroy', 'UserMediaController@destroy');
Route::post('mediaMove', 'UserMediaController@move');
Route::post('mediaCreate', 'UserMediaController@create');
And instantiate the laradrops like this
<div class="laradrop"
laradrop-file-source="/mediaIndex"
laradrop-upload-handler="/mediaStore"
laradrop-file-delete-handler="/mediaDestroy"
laradrop-file-move-handler="/mediaMove"
laradrop-file-create-handler="/mediaCreate"
laradrop-csrf-token="bVgziBueIHaJqYdIruMg5pW2tISSEFMs9Qc5K7AY">
</div>
Any idea why it doesnt hit my new controller?
Hi guy,
I will have many assets files managed by laradrop, can laradrop support multi users ?
save the file in dinamic directory?
it's possibile alert if the file have equal name with other file?
thanks
Hi jasekz,
I will have many assets files managed by laradrop, can laradrop support paginator feature?
thanks~!
Is laradrop compatible with 5.3 or is it only tested on the 5.2 file structure?
hello i want to show only only those files to users, which are related to them no other files.....is there a way arround?
Some of my thumbnails generated are rotated 90 degrees counterclockwise. What is the factor in determining whether a thumbnail generate will be rotated?
hello
I save my photos in a folder like this
$disk->put( 'cofeeshops/' . $coffeeshop->id . '/main/' . $movedFileName, fopen($tmpStorage . '/' . $movedFileName, 'r+'));
and save the path of photos in the photos table that I created in db like this
`
$photo = new Photo();
$photo->path = $disk->url('cofeeshops/' . $coffeeshop->id . '/main/' . $movedFileName);
$photo->directory = $disk->url('cofeeshops/' . $coffeeshop->id . '/main');
$photo->imageable_id = $coffeeshop->id;
$photo->imageable_type = 'coffeeshop';
$photo->save();`
now, how can I develop my own index method?
Is currently a way to limit the file extensions that the user is able to upload?
Or maybe,
I can validate the extension on onInsertCallback
but I don't know how to remove from the list of files to the upload.
If you could give me some hints I would appreciate it. Thanks in advance
In boot method on LaradropServiceProvider.php there is some file address than a need to publish.
when I use 'artisan vendor:publish' these files do not publish on a related directory.
please help me to fix this problem.
hello I am trying to implement my own handler
It does not appear to do anything
I have tested the route independently and it works
the route is in my route file not laradrops - is that correct?
I think this would go well with the spirit of using vuejs with laravel
https://github.com/rowanwins/vue-dropzone
And also Laravel 5.4 just came out. I don't know if there's any incompatibility with this plugin.. probably not
Love your work! Thanks!
as the title say laravel won't pull files I'm calling from vendor
for example
<script src="vendor/jasekz/laradrop/js/enyo.dropzone.js"></script>
<script src="vendor/jasekz/laradrop/js/laradrop.js"></script>
It says it cannot find them
EDIT: Found the problem but cannot find solution. artisan vendor:publish does not copy the public file to assets
Hi, it is great to use laradrop package in laravel 5 project.
Unfortunately, it seems laradrop does not support utf-8 filenames. I test it with a chinese δΈζ.jpg, the file existing in directory seems mess. The english name is ok.
Please check it.
Thanks!~!
php artisan publishing is not pulling the files , i tried to clear configs , to clear chache , to autodump , not working at all. please fix this
Hi Jasekz,
Thank for your package. It's interesting me. But I have a problem when install it into my project. When I install and run my url it show alert "Not Found". I followed all steps to install. Thank Jasekz again. Regards,
Hello
The folder preview and thumbs were not showing.
I removed the / before vendor in the line below in laradrop.js and now the folder shows.
folderImage = options.folderImage ? options.folderImage : 'vendor/jasekz/laradrop/img/genericThumbs/folder.png',
In the database public_resource_url if I remove the leading / then the thumbnails show.
I must have a setting wrong somewhere?
Thanks for any help.
Regards
Del
it possible to integrete with tinymce4 or ckeditor? if possible,. please give me a documentation :D
EDIT: Found the answer in the laradrop.js file:
folderImage = options.folderImage ? options.folderImage : ' /vendor/jasekz/laradrop/img/genericThumbs/folder.png',
Hey :)
I'm integrating this package into a Laravel 5.4 application - I've got everything configured and working well, other than the folder image.
No matter what I have tried, I cannot change the location of this image from the vendor folder which won't load into the browser even though I can see it exists in the vendor folder.
<img src="/vendor/jasekz/laradrop/img/genericThumbs/folder.png" alt="09.08.2017 - 13:33:57">
This always returns not found. I've scoured the source files of the package and cannot find a place to change this path to a publicly accessible one (the app I am extending has a non-standard assets path above the project folder).
Could you point me to the correct place to change this path to reflect my installation config?
I have the file ready in a publicly accessible folder:
http://mydom.com/assets/vendor/jasekz/laradrop/img/genericThumbs/folder.png
So I would just need to prepend 'assets/' to the image src string.
Thanks :)
hello I am getting this error after following the install instructions
laravel 5.2
Hi Jasekz.
In my project, I want to give a different location for each user. I know it is easy with dropzone. In Laradrop there is no option for it. Give me a clue to fix this.
Thank you!
hi
Do you have any documentation about the "laradrop.js"?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.