classic-o / nova-media-library Goto Github PK
View Code? Open in Web Editor NEWMedia Library for admin panel "Laravel Nova"
License: MIT License
Media Library for admin panel "Laravel Nova"
License: MIT License
Description
When setting the Media picker field against a resource using:
MediaField::make('video')
if a MP4 or video is selected the file name is not shown against the selected item.
To Reproduce
Steps to reproduce the behavior:
Wouldn't it be better if the API::upload returned the path of the image or an json with values?
Other issue
I am having problems with the multiple selector. Anyone else?
Great job Pavel.
I've got it working beautifully with a single file upload but when I try to allow multiple files by adding ->array() I get the following error when I try to submit the form for the resource to create.
Array to String conversion - There was a problem submitting the form. ""
It allows me to select multiple images and they display on the page but gives that error on submit.
This is the way I'm using it:
MediaLibrary::make('Image')->array('gallery'),
The column in the database is called "image" and is of the type "text".
"php": "^7.3|^8.0",
"benjaminhirsch/nova-slug-field": "^1.2",
"classic-o/nova-media-library": "^1.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/nova": "~3.0",
"laravel/tinker": "^2.5",
"league/flysystem-aws-s3-v3": "^1.0"
If I submit the form without the ->array() option it saves and shows the image properly. I can then add the ->array() option and edit the content and add multiple images without error. It only seems to happen when submitting new content not on editing.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
I would like to add some additional features to this package (mainly cropping + Filesytem s3 support). But the original css/js assets are not in the git repo.
Are you able to provide these and I can continue my work and submit a pull request?
I have digital ocean setup and able to upload images but when i use the MediaField it uploads to my public storage. does digitalocean spaces support need to be added?
Hi, First of all thank you for the hard work and providing us with this nova lbrary.
How can i upload images to only show for the post it was uploaded in?
sorry im new and trying to figure this out.
Describe the bug
I remove the maximum upload limit of files in the category 'docs', and I try to upload a pdf file of more than 2mo
To Reproduce
Steps to reproduce the behavior:
Additional context
exemple of pdf
Describe the bug
I have the filesystem disk set to "S3" and have specified the s3 URL but not sure if that is set correctly.
When I try to upload an image I get the error "The PutObject operation requires non-empty parameter Bucket".
I have the following vars set in my .env
S3_BUCKET=XXXXX
S3_PREFIX=XXXXX
S3_URL=https://s3.amazonaws.com/
S3_GET_IMAGE_URL=XXXXX
AWS_URL=XXXXX
Can you post an example of .env vars I need to set in order to use s3 for storage?
Is your feature request related to a problem? Please describe.
Overall this library is fantastic, but we are looking for a way to include media that is not fully hosted on our system such as embeds of videos.
Describe the solution you'd like
It would be great if you could specify an embed upload where you would essentially add a title, the embed url, and potentially some custom meta info and that would be saved the media library. This way you could use the same piece of media all over your site and manage the embed url from a single source.
Is there a way of being able to edit (e.g crop) the image directly from a Resource form view?
I know you can edit an image directly from Media Library tool, but I was wondering if there could be a feature that could allow you to edit the image via the MediaLibrary field.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Hi, the module is awesome! But it feels like a little incomplete. I would like to open images not in a new windows, but in a modal or colorbox like solution.
Describe the solution you'd like
When clicking on an image on a resource detail view, the image should be opened in a modal.
Describe alternatives you've considered
None
Additional context
None.
I created Nova TinyMCE5 editor integration field which works well with the Nova Media Library so you can use TinyMCE editor and insert images from Nova Media Library into your content.
Check it out here: Nova TinyMCE5 Editor
Feature request. Great package. I receive very good feedback from my users, however, there is a specific use case which is not catered for but I think would be a great enhancement.
Use case:
Current behaviour:
Requested behaviour:
Keeping the same file ID is important. If there was a way to update the file whilst retaining the same file ID, then I can create a custom route or model, using the API to get files via ID and redirect to the correct file path.
Thanks,
Problem:
When I view my media library in Nova - I see folders that I do not expect to see.
Expected Behaviour:
In the nova-media-library config file, I have defined the folder of storage as 'medialibrary'. So when I view my media library in Nova, I expect to see folders created within this folder only.
Actual Behaviour:
When I view my media library in Nova, I see folders which are outside of the defined 'medialibrary' folder. These are other folders from the 'storage/app/public' directory.
storage/app/public/medialibrary - contents:
storage/app/public/images - contents:
Why are the subfolders in 'storage/app/public/images' appearing when I view my media library in nova when I have defined my media library folder as 'storage/app/public/medialibrary'?
An array of either 'gallery' or 'list' is not visible after saving resource. Both versions are visible when first adding to the field before saving, but then after saving only the "Select Files" button is visible. The actual array of ids is persistent in the database, which is set as a column of nullable text, it just doesn't seem to be rendering within Nova when editing the resource. The items are also not in the list view, in the manner that is demonstrated in the readme. I was able to replicate this on two different installs of Laravel 7 with Nova 3.0.1. Single images are working as expected.
Sorry, if I am just missing something simple.
Thank you for the great tool!
Thank you for this excellent nova package.
Right now, if upload a file, it will add some random string to the end of file name automatically.
How to prevent it? So keep the the original file name?
Also, the menu is showing at the bottom of the navigation sidebar right now. Can I set the position where to show it?
Thank you.
Hi there,
just wondering if you can use AWS s3 with this media library? if so how would i configure this?
Hello! First of all, thank you for this work and this package!
I have a small question about the save in the database
In the "Nova_media_library" table, the name is saved correctly while in my "photos" table, it's the id that is saved. So when I want to do "$album->photos[0]->path" I get the ID and not the name of the image.
Is it possible to get the file name instead of the image ID? Because when I want to display the path of the image, it does not necessarily find the image
Thanks again, this is exactly the package I needed!
Is your feature request related to a problem? Please describe.
Running php artisan migrate:rollback
and php artisan migrate
again results in error Base table or view already exists: 1050 Table 'media' already exists…
Describe the solution you'd like
Add
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('media');
}
to migration
Hi, I don't see it in the thumb index. I don't see the gallery even when editing user ... Don't you know where I have an error? And how do I fix it? Well thank you.
MediaLibrary::make('Gallery')
->array()
->preview('thumb'),
It would be super if you implement resizing feature to the images.
Is your feature request related to a problem? Please describe.
I would like to restrict my users from being able to access all files and folders. I'll create a PR for this, just running by you for acceptance before I write the code.
Describe the solution you'd like
When using the Field, I would like to specify if it should be uploaded to Resource Folder like /users/1/profile.png
by calling MediaLibrary::make('Profile')->createFolder()
. When a User opens upload, it automatically creates the resource's folder and selects as the starting point when Media Uploader opens up
NovaMediaLibrary to have MorphOne
relationship so we can check a folder's linked resource like $folder->morphable->id == auth()->user()->id
. We then utilize Resource Policy like $UserPolicy->view()
to check access to that folder.
Describe alternatives you've considered
Another alternative is to not hook folder access based on resource policy, but based on users assigned to that folder. It becomes messy, but can be added as additional functionality later on.
Additional context
Add any other context or screenshots about the feature request here.
The bug
When uploading a file larger than what is allowed in the config, the Media Manager will refuse to upload the image, and no error / notification is shown as to why.
To Reproduce
Steps to reproduce the behaviour:
'max_size' => [ 'Image' => 2097152, 'Docs' => 5242880, ],
There should be a warning, something like "The file you tried to upload is larger than 2MBs".
I'm trying to attach multiple images to a resource from the media library.
MediaField::make('Photo', 'photo_path')
->withTypes(['Image'])
->listing('line')
However, Array to String conversion
error pop's up on save.
Any suggestions?
I want to be able to set an image size in config/media-library.php to be used when displaying images in the media library view.
Right now it's using the original size that results in huge amounts of data and unnecessary long loading times when browsing large uploaded images.
These headers should just always be here. In Chrome if the video is a media file then it causes problems (like being unable to skip around or not pre-loading the whole file). I would also suggest that we store the filesize in bytes instead of with the "kb" or "mb" text. I was able to add them manually since API::getPrivateFile()
returns a \Illuminate\Http\Response
class instance which solved my issue. This could just be baked in though.
In my case I was also using s3 with files as "private" so it was piping the file through laravel but I imagine it would have the same issue without it coming from s3.
Example if file size is 1234
bytes.
Content-Length: 1234
Accept-Ranges: bytes
Content-Range: bytes 0-1233/1234
Some examples of others with this problem (in general):
https://stackoverflow.com/questions/45805177/chrome-cant-fast-forward-firefox-can-display-mp4-file-with-php
https://stackoverflow.com/questions/61022041/unable-to-skip-audio-in-chrome
https://stackoverflow.com/questions/10583931/cant-seek-html5-video-or-audio-in-chrome
Describe the bug
NovaMediaLibrary massively slows down all Nova requests when the configured folder contains subfolders.
To Reproduce
Have multiple levels of folders (in my case, four levels) in the configured disk and all Nova requests are slowed down. The more subfolders you have, the slower it gets.
After some testing, I have found the problematic function is Helper::directories(), called by NovaMediaLibrary::config() during Nova's boot process.
Screenshots
Example: a Nova script request.
With NovaMediaLibrary tool enabled:
With the tool removed from NovaServiceProvider::tools():
With the tool enabled and some subfolders removed from the storage:
Additional context
Strangely enough, when I test the function (Helper::directories()) in Tinker in the exact same environment, the operation isn't slow at all. It might be a Laravel bug, I honestly have no idea.
Anyway, I think it's a bad practice to read the filesystem during the tool's boot process. It's a slow operation and the tool is booted at every Nova request. I suggest moving the Helper::directories() operation to an API endpoint called by the Tool component.
Describe the bug
Getting 'forbidden file format' error when uploading any kind of image.
To Reproduce
Steps to reproduce the behavior:
Additional context
NGINX and Laravel config are already set to 100mb max file size, furthermore form image uploads on the front end work without problem, likewise does the vanilla Nova Image::make file upload work without problem.
Running Laravel 8 with Laravel Nova v3.23.2 on Laravel Homestead
At the moment, if using Laravel Nova in conjunction with Laraval Vapor, there's a pretty low limit on file upload size (around a couple of MB) - this is due to the limits with AWS Lambda. Laravel Nova offers a mechanism for file uploads to Vapor, using a direct to S3 method, documented here (https://nova.laravel.com/docs/3.0/resources/fields.html#vapor-image-field) and here (https://docs.vapor.build/1.0/resources/storage.html#file-uploads)
It would be great if nova-media-library could support this feature to allow uploads of greater file size on the Vapor platform, especially as the rest of the feature-set is something we absolutely love, and really want to integrate into our projects!
Hi,
I am looking import media into the media manager from an API source. There doesn't seem to be any documentation on how to programatically add media. Any ideas? Thanks in advance.
Describe the bug
A clear and concise description of what the bug is.
While viewing the medialibrary in Nova and having specified a storage folder in the config file, it is showing other folders I have in my storage/app folder. See the screenshots.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
If there is twice the "MediaField" field in the same panel, filling one of the two fields validates both inputs
It would be possible to add the method "storeAs" (as on the native input Image) for patched the worry
This feature is not directly related to something malfunctioning, but something not functioning in an ideal way.
My S3 bucket is set to private, and so Nova Media Library requires I have private
set to true
. However, instead of using the nova-media-library.url
config option, based on the AWS_URL
env value, the URL is created using the nml-private-file
route in the tool. In my case, CloudFront should be handling access to the private objects at S3.
It would be ideal to optionally override that private route, or choose not to use the private route and use the normal URL format, even if configured to use private
mode.
Is your feature request related to a problem? Please describe.
Laravel is capable of figuring out the URL to a file itself. It's a small annoyance to have to introduce a new environment variable because this package creates the URL to a file itself instead of using Laravel's build-in methods.
Describe the solution you'd like
I can create a Pull Request which will update ClassicO\NovaMediaLibrary\Core\Model::getUrlAttribute
to use Storage::disk('foo')->url('bar.jpg')
.
Describe alternatives you've considered
If this approach has already been considered, and there are issues I'm unaware of, please let me know!
Additional context
Laravel documentation: https://laravel.com/docs/5.8/filesystem#file-urls
This package would be absolutely perfect...with a way to drag an image or group of them, into a rich text field, Trix, Trumbowyg, Froala, etc. There are a lot of choices now, which may make a universal solution difficult, but even a way to make it possible to integrate that functionality with your richtext of choice, would be huge. 👍
Thanks for a great package.
Is your feature request related to a problem? Please describe.
I need to change the sidebar icon from paperclip to other.
Describe the solution you'd like
New setting in config to put svg content or link to svg file
Would it be possible to show a thumbnail on the index list instead of the generic file type icon? I think this would improve the overview in the list when having single images.
Thanks for the great package!
** I did the translation to portuguese from Brazil and I would like you to include the package support, a word that I could not translate because I did not find the key was this:**
Following the translation file thank you in advance
Describe the solution you'd like
It would be great to have an option to switch from "card view" (as it is now) to a list view inside the view (not in conf). It would be handful especially for document. If possible having the name, date of upload and maybe size ?
All these fields are well provided in the database
Thanks,
We would highly appreciate the possibility to add additional (translatable) Nova fields to an image. We would require this functionality to provide localized ALT texts for SEO and accessibility purposes.
Something similar to https://github.com/ebess/advanced-nova-media-library "Custom Properties" would be great.
Sidenote: We really like this library a lot more than the project I just referenced, but this is the only thing that is missing from our perspective. Thanks in advance!
Describe the bug
When using the S3 file driver and attempting to upload I receive a 403 error.
I have set the relevant config on nova-media-library and have tried setting the 'private' option to false & true, both fail.
To Reproduce
Steps to reproduce the behavior:
Additional context
I'm using Laravel 8.
If I change the ClassicO\NovaMediaLibrary\Core\Upload.php file in the save() function and remove "Helper::visibility($this->private)" it resolves the issue.
I see this as only a temporary fix and this is why I've not made a pull request.
The documentation states that it is possible to save media with its ID instead of the URL. In your model stores only id of file(s).
The documentation is missing on how to actually accomplish this. I would rather store the media ID, so that I can have access to the data stored in the nova_media_library
table.
Ultimately the goal is to display the file size in the view. (Required for accessibly).
When I try to upload a 100mb file on the Media Library, it says it's using around 900MB of memory. This is HUGE. Perhaps we can either stream the file right to s3, or store it locally to be uploaded in the background. I believe this is happening because the file being uploaded is stored as a variable more than once on it's way to s3.
Describe the bug
Hi @classic-o , thanks for your amazing plugin! However, when I click 'bulk select' from within the media library I am only able to select one item. I also notice that the bulk select action buttons are not displayed.
To Reproduce
Steps to reproduce the behavior:
Additional context
I see the same issue when I 'open library' from within a resource.
Laravel v. 6.4.0
Nova v. 2.6.1
Media Library v. 0.5.2
Thanks for your help
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.