Questions tagged [laravel-medialibrary]

Laravel-medialibrary is a popular Laravel package to associate media files with eloquent ORM models

Useful links:

105 questions
1
vote
1 answer

How in livewire 2 app upload image in laravel-medialibrary?

In Laravel 8 / livewire 2 app I added spatie/laravel-medialibrary 9, when a preview of selected I make with methods ... Livewire.on('fileChosen', app_image_id => { …
mstdmstd
  • 2,195
  • 17
  • 63
  • 140
1
vote
0 answers

Problem updating Laravel Media Library from v6 to v9

I'm updating a project from v6 to v9, and after checking https://github.com/spatie/laravel-medialibrary/blob/master/UPGRADING.md i got this message at postAutoloadDump: In User.php line 287: Could not check compatibility between…
1
vote
1 answer

Spatie Media Library (Pro) - attach auth token to `upload` call

I am using Spatie's Media Library (Pro), and we have an SPA that requires all the calls from the front-end to use an auth token with some "context" information. (Our front-end is Nuxt.js/Vue.js; we send the calls to a micros-service gateway, but…
jmadsen
  • 3,635
  • 2
  • 33
  • 49
1
vote
2 answers

View files inside storage folder for authenticated User

I am using spatie library to upload some files which will be saved to the storage folder. What I want to accomplished at the moment, is to view those files or images when I am an authenticated user. I've tried creating a symlink using this command…
Hope
  • 644
  • 2
  • 6
  • 21
1
vote
1 answer

How to get all media with conversion in Spatie?

I am working with Spatie Media library in Laravel , I can only get first media url while mentioning conversion type & collection : $model->getFirstMediaUrl('collection','conversion'); How can I get all of the media with collection and conversion…
Hesam Moosapour
  • 510
  • 5
  • 12
1
vote
1 answer

Laravel spatie media library regenerate conversion with same conversion but difference format

Currently I trying to regenerate image from current format .png to default (jpg).. But I notice that I generate new file with new format.. So now have images with format .png and .jpg.. So how can I replace the old format or delete it.. From my…
shahrizal
  • 21
  • 5
1
vote
1 answer

BadMethodCallException: Call to undefined method App\Models\User::getFirstMedia()

I am trying to do: $this->assertFileExists($user->getFirstMedia()->getPath()); In my test. But when I run it I get this error: BadMethodCallException: Call to undefined method App\Models\User::getFirstMedia(). I do: use…
Parsa_237
  • 117
  • 1
  • 2
  • 12
1
vote
1 answer

Laravel Route Troubleshooting

I am trying to figure out why my route is throwing a 404 error rather than providing my image. I am using Spatie media library to serve private images. I have the following routes web.php: Auth::routes(); Route::get('/home',…
QuotidianVoid
  • 609
  • 5
  • 12
1
vote
2 answers

Spatie media library pro - Can't resolve '@spatie/media-library-pro-vue2'

Hi guys I am having trouble setting up Spatie Media Library pro. I am getting following error when I am building my resources with npm run dev ERROR in…
1
vote
1 answer

Laravel Spatie's Media Library: how to download multiple files and zip them inside a directory

I am using Spatie's Media Library to upload files. Then, I allow a user to download a specific set of files by using the following method: return MediaStream::create('prefix-'.$model->name.'.zip')->addMedia($mediaFiles); In macOS I download that…
Pathros
  • 10,042
  • 20
  • 90
  • 156
1
vote
1 answer

How to addMedia to another database using laravel-medialibrary

so i am trying to override laravel-medialibrary so that when i run $modelA ->addMedia($attachment) ->withCustomProperties(['model_id' => $modelA->id]) ->toMediaCollection('attachments_a'); , it adds a record into another specified database…
Napmi
  • 521
  • 2
  • 13
  • 32
1
vote
1 answer

How should I set data type for my media using laravel nova spatie media library

I would like to be able to only upload PDF. I have seen methods here acceptsFile or acceptsMimeTypes that could do the trick, but it seems that it will give an error at submiting the file. I was loooking for a way to only be able to select pdf. With…
Juliatzin
  • 18,455
  • 40
  • 166
  • 325
1
vote
1 answer

File `{$path}` does not exist error In laravel

Can you please help me this error,i am stuck in that error from two days. i have work in laravel multiple images upload.but whenever i upload the images it will show below error…
Swrajj
  • 11
  • 1
  • 3
1
vote
1 answer

Get Media model by ID and use it to make a downloadable URL doesn't work

In my CustomProduct model I have multiple media's When I fire a GET request I add the product id & the media id. When I try the following code below, It's a Eloquent Collection. but I need it to be a Media model because I can't call ->getPath()…
1
vote
1 answer

How to change collection_name in spatie?

I'm a newbie in spatie. I have some trouble, I don't know how to change collection_name in spatie. I select a record with collection_name is enter code here and change it to doctor_avatar and I do like: $media = Media::where(['model_id' => $id,…
Ngoc Tran
  • 69
  • 2
  • 12