Laravel-medialibrary: addMediaFromDisk still moves the media?

Created on 27 Jun 2020  路  6Comments  路  Source: spatie/laravel-medialibrary

I'm currently working on implementing Livewire uploads myself to work with media-library for a project I'm working on, and I've noticed upon calling addMediaFromDisk it moves the uploaded file from my actual directory to an auto-generated one by media-library, but that doesn't seem to make much sense? Why would it move it if it's already on the disk. Surely if it's already on the disk it's somewhat implied that you are referencing an already existing image and don't want to move it?

I'm aware preservingOriginal exists but I don't want to copy OR move the file. I want it to stay exactly where it is and for media-library to just keep track of it via DB model.

Also another thing I haven't really gotten my head around yet, how would binding work from media-library with file uploads. E.g say you've already uploaded an image and want to show it the user on an edit form, what would be the best way to do that? To my knowledge Livewire requires it to be a file object, but with media-library you're only able to obtain the URL's/path. So would I have to find the file object myself via Storage::get(), or something similar?

Most helpful comment

We are going to solve these problems and more in the upcoming https://medialibrary.pro
ETA: somewhere this summer.

That's a paid product. This doesn't seem like an appropriate response for closing an issue.

All 6 comments

We are going to solve these problems and more in the upcoming https://medialibrary.pro
ETA: somewhere this summer.

@freekmurze Thanks for the quick reply however I'm not really sure if this helps me sadly. :/ While I understand the course will have the answers, I can't really put my use-case on hold for a month or two to wait for it, and in another issue I saw you mention it is possible with the current version of media-library.

I've done most of it, the main part that I'm struggling with still is exactly what I said in my main issue.

It would be nice to know if it's possible at all with the current version of media-library, otherwise I will need to find something else.

I like Spatie and I like the projects you guys put out but I really can't justify putting stuff on hold to wait for the course if it's possible in the current version.

Hopefully you can understand.

@marbuser I am running in the same problem, have you found a workaround this matter?

I also have the same problem

I also have the same problem

We are going to solve these problems and more in the upcoming https://medialibrary.pro
ETA: somewhere this summer.

That's a paid product. This doesn't seem like an appropriate response for closing an issue.

Was this page helpful?
0 / 5 - 0 ratings