Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The directory method ->dir('my_directory') doesn't work #4

Open
alexander-bet opened this issue Jun 20, 2023 · 1 comment
Open

The directory method ->dir('my_directory') doesn't work #4

alexander-bet opened this issue Jun 20, 2023 · 1 comment

Comments

@alexander-bet
Copy link

alexander-bet commented Jun 20, 2023

Hi, I have tried the Moonshine admin panel with the Image class and it works very good
Image::make('Heading image', 'cover') ->disk('media') ->dir('/posts') ->allowedExtensions(['jpg', 'gif', 'png']) ->removable(),

RESULT:

/storage/public/media/posts
first_image.jpg
second_image.jpg

The MediaLibrary class also works for me, but the trouble is my directory '/posts' isn't created in my 'media' direcrory. When I add images to posts, I see new folders numerated '1' and '2' .... '10' with the images inside of them.

/storage/public/media/1
first_image.jpg
/storage/public/media/2
second_image.jpg
/storage/public/media/3...... etc.

So, the logic of method dir() of MediaLibrary class isn't the same as in Image class.

I've read the media-library.php config file also, but still don't know how to make dir() method working as it does with Image class.

@alexander-bet
Copy link
Author

In addition. I found out in the Spatie Media Libraty Documentation a decision for my question with CustomPathService class for media files. That's good. The documentation link - https://spatie.be/docs/laravel-medialibrary/v10/advanced-usage/using-a-custom-directory-structure
In other hand, it could be great if the dir() method of MedialLibrary class working too:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant