Code Monkey home page Code Monkey logo

nova-media-library's People

Contributors

classic-o avatar e-liegeois avatar jebble avatar manogi avatar marcreichel avatar nibri10 avatar pxlrbt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nova-media-library's Issues

Media Field shows blank value when a single video file selected

  • Laravel Version: 5.8.35
  • Nova Version: 2.4.0
  • PHP Version: 7.3
  • Browser type and version: Chrome v77

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:

  1. Go to resource where media picker is set and select video file
  2. No file name shown, just options to clear or reselect.

Screenshots
Screenshot 2019-10-17 at 10 07 39

API::upload response

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.

SVG File are not displayed, paperclip instead

Describe the bug
Svg is not display on the media library tab, a paper clip is display instead.
Previous version does support svg file.

To Reproduce
Steps to reproduce the behavior:

  1. Go to media library tab
  2. Click on 'Upload Files'
  3. Select an SVG file
  4. Paperclip is display

Screenshots
svgTest

Array to String conversion - There was a problem submitting the form. ""

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.

How to get file by name instead id?

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. See error

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Vue - original JS/CSS files

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?

Digital Ocean Spaces

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?

Custom folder based on post

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.

Bulk select checkbox covers whole thumbnail

When activating bulk select, the checkbox is covering the whole image, so you don't see which images to select.

To Reproduce

  1. Open Modal
  2. Click on "Bulk select"

Screenshots
image

Error when upload pdf file

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:

  1. Go to 'media libraries'
  2. Click on 'upload files' and select my file
  3. See error

Screenshots
Image of error

Additional context
exemple of pdf

Error The PutObject operation requires non-empty parameter Bucket

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?

Add embed media type

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.

Edit Image on Resource Update/Create Form View.

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.

Allow to open images in modal

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.

TinyMCE5 integration

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 Req: Ability to update media library item

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:

  • User cannot update the existing media library item.
  • User has to upload the amended PDF file which results in a different URL and a different file ID.
  • I have to update all of the hyperlinks.

Requested behaviour:

  • Ability for a user to edit/upload a new file when viewing a media library item.
  • This would keep the same URL (if the filename is the same) and the same file ID regardless.

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.

image

Thanks,

Unexpected folders appearing

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.

Screenshots
Config:
image

Folder Structure:
image

storage/app/public/medialibrary - contents:
image

storage/app/public/images - contents:
image

Nova View:
image

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'?

I don't expect to see the folders highlighted:
image

Array list/gallery not visible in Nova

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.

image

image

Sorry, if I am just missing something simple.
Thank you for the great tool!

How to keep the original file name when uploading files

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.

Integration with s3 driver

Hi there,

just wondering if you can use AWS s3 with this media library? if so how would i configure this?

How to save the filename in the model table instead the ID

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!

2
Capture

Migration rollback: Set down() method

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

Thumb not displayed

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'),

Resize images

It would be super if you implement resizing feature to the images.

Folder Permissioning based on Resource Policy - I'll create a PR

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

  1. 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

  2. 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.

No error/notification message when a file fails to upload

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:

  1. Set size limit in the config for images.
    'max_size' => [ 'Image' => 2097152, 'Docs' => 5242880, ],
  2. Try uploading a an image larger than what is allowed. (In this case, limit is 2 MBs).
  3. Image will not upload. No message as to why is given. "Uploaded files: 0/1" green pop appears.

There should be a warning, something like "The file you tried to upload is larger than 2MBs".

Array to String conversion error

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?

Files through laravel should include 'Content-Length' and 'Content-Range' headers

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

Very slow boot when storage folder contains subfolders

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:
tool-activated
With the tool removed from NovaServiceProvider::tools():
tool-deactivated
With the tool enabled and some subfolders removed from the storage:
less-subfolders

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.

Forbidden file format error on all image uploads

Describe the bug
Getting 'forbidden file format' error when uploading any kind of image.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Nova Media Library tab'
  2. Click on 'Upload'
  3. Upload any image (I tried png and jpg)

Screenshots
image

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

Direct to S3 file uploads on Laravel Vapor

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!

Programatically add media to the media library

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.

Other folders in storage/app showing

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.
image

image

image

Additional context
Add any other context about the problem here.

duplication if two MediaField fields are present

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

Access private S3 objects via CloudFront URL instead of private tool URL

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.

Remove configuration value for URL

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

Some Kind Of Integration With Rich Text Fields

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.

Allow change icon in Nova sidebar

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

Image preview on index

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!

ADDING TRANSLATE PT-BR

** 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:**

@pxlrbt @classic-o

Following the translation file thank you in advance

image

pt-br.zip

List view

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,

Provide possibility to add localizable ALT text for images

Feature Request

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.

Bildschirmfoto 2020-11-20 um 10 50 00

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!

403 Error When Uploading to S3

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:

  1. Set a S3 based disk on nova-media-library config
  2. Upload a file through the media library in Nova
  3. Error 403 received.

Screenshots
Screenshot_208

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.

Unable to store media ID instead of URL

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).

Uploading to s3 php memory issue

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.

Bulk Select Not Working - when upgrading Nova to v2.6

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:

  1. Go to 'Media Library'
  2. Click on 'Bulk select'
  3. Select image/file

Screenshots
Screenshot 2019-10-31 at 4 41 55 PM

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.