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

Enhancement: let users sort their files in media dashboard #178

Closed
LuiseFreese opened this issue Nov 16, 2021 · 25 comments
Closed

Enhancement: let users sort their files in media dashboard #178

LuiseFreese opened this issue Nov 16, 2021 · 25 comments
Labels
enhancement New feature or request
Milestone

Comments

@LuiseFreese
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I don't want to go over several pages of media in order to find the image I want to insert.

Describe the solution you'd like
let me (and other users) sort their files, from A-Z, new to old and/or implement search to search for a specific image

Describe alternatives you've considered
alternative is to manually insert the link and not previewing the image in the dashboard

Additional context

@estruyf estruyf added the enhancement New feature or request label Nov 17, 2021
@estruyf
Copy link
Owner

estruyf commented Nov 17, 2021

Thanks @LuiseFreese! It makes a lot of sense to have this functionality added to the media dashboard!

estruyf added a commit that referenced this issue Nov 17, 2021
@estruyf
Copy link
Owner

estruyf commented Nov 17, 2021

@LuiseFreese first implementation of the sorting for the media dashboard is completed. At the moment, only sorting based on the filename is supported.

Sorting by the creation/modified date is a bit tricky, as that can lead to performance issues depending on the number of files. Currently, the dashboard shows batches of 16 files, if we want to enable this type of sorting. The statistics of all files need to be fetched first before sorting can be accomplished.

@estruyf
Copy link
Owner

estruyf commented Nov 17, 2021

Feel free to test out the latest beta which has the filename sorting in place.

@zivbk1
Copy link

zivbk1 commented Nov 17, 2021

I wonder if some kind of library caching option could be available. To make a pass through all the files and then store some data about them all in the media db file. Then when adding or deleting files you update the DB file as part of the operation, or run a sync manually or in the background. This way you are sorting/listing the data in the file and not requiring file read operations each time you open or sort the library.

@estruyf
Copy link
Owner

estruyf commented Nov 17, 2021

@zivbk1 I have been thinking about that as well. Although I'm not a fan of syncing. Most of the time, it causes issues but thinking about a better and more robust solution.

Question to @LuiseFreese and @zivbk1. What do your asset folders look like? Is it one folder with all the files? Or multiple folders to structure the content?

If it is the last, it might less be an issue, as fewer files will be retrieved all at once than if you have all files in the root folder.

@zivbk1
Copy link

zivbk1 commented Nov 17, 2021

I typically have a single 'uploads' folder under my 'static' folder in Hugo where I put all the images that are used in content and layouts. I don't tend to put any subfolders inside of it.
I do have some sites where all of my media assets (images, videos, binary files (PDF, ZIP, XLSX, etc.)) are in different folders, but the images folder doesn't have any subdirectories. These assets are not stored in my git repo. I put them in an S3 bucket and use CloudFront to expose the bucket to the world at a custom subdomain, like files.mydomain.com. The only downside to this is most editors can't just insert a path reference. In this case, I only ask the editors to use the asset filename in the content source or frontmatter parameter and I use shortcodes, partials, render hooks, etc. to use the correct URL to the asset when it is rendered to the browser. Having an integration to upload and list files in an S3 bucket would be awesome in the FM UI, because I could do this same trick with all my sites and get binaries out of my repo as much as possible.

@estruyf
Copy link
Owner

estruyf commented Nov 18, 2021

Those are good insights @zivbk1! For the media snippet, would it help for you that there is also a {filename} token besides the: mediaUrl, caption, and alt?

@zivbk1
Copy link

zivbk1 commented Nov 18, 2021

Yes, that would help with the DAM use case, where the files live outside of the repo.

@LuiseFreese
Copy link
Contributor Author

I have an images folder in my static folder for my Hugo site.. no subfolders :-)

@estruyf
Copy link
Owner

estruyf commented Nov 18, 2021

New beta version with support for macOS and Linux date sorting. The next step is to work on support for Windows.

@LuiseFreese
Copy link
Contributor Author

So it could already work on WSL2?

@estruyf
Copy link
Owner

estruyf commented Nov 18, 2021

Hasn't been tested in WSL, but it could work. As WSL2 is "just" Linux.

@estruyf
Copy link
Owner

estruyf commented Nov 18, 2021

Windows support has been added as well. @LuiseFreese @zivbk1 could you verify this on the beta that it's working for you? I've tested it on my devices, but that is not always a good reference 😊

@zivbk1
Copy link

zivbk1 commented Nov 18, 2021

I use GitPod, which I think uses a version of Ubuntu Linux. I'll test it later this morning.

@estruyf
Copy link
Owner

estruyf commented Nov 18, 2021

@zivbk1 true! I've just tested it on a GitHub Codespace, there it seems to work too.

@estruyf estruyf added this to the 5.6.0 milestone Nov 18, 2021
estruyf added a commit that referenced this issue Nov 18, 2021
@estruyf
Copy link
Owner

estruyf commented Nov 18, 2021

Ok, I went back to the original file checks. As its performance is way better. 🙃

At least it was a good validation.

estruyf added a commit that referenced this issue Nov 18, 2021
estruyf added a commit that referenced this issue Nov 18, 2021
@LuiseFreese
Copy link
Contributor Author

I can confirm it works on Windows 10 and in WSL2 🚀🚀

@estruyf
Copy link
Owner

estruyf commented Nov 19, 2021

Thanks, @LuiseFreese for confirming this!

@zivbk1
Copy link

zivbk1 commented Nov 19, 2021

It works well in GitPod too! :D

@estruyf
Copy link
Owner

estruyf commented Nov 19, 2021

Thanks @zivbk1!

@zivbk1
Copy link

zivbk1 commented Nov 20, 2021

@estruyf can we define the sort options like we can with our content types?

@estruyf
Copy link
Owner

estruyf commented Nov 21, 2021

Not at the moment, but it could be a new option/property to be added.

@estruyf
Copy link
Owner

estruyf commented Nov 21, 2021

BTW @zivbk1 on what things do you want to sort your media?

@zivbk1
Copy link

zivbk1 commented Nov 21, 2021

@estruyf Off the top of my head would be:

  • filename
  • size
  • date
  • title
  • alt text

The last two above would need to come from the media DB file if defined.

If there is a way to query/store the following data I could see them as useful also.

-width (px)
-height (px)

@estruyf estruyf mentioned this issue Nov 23, 2021
@estruyf
Copy link
Owner

estruyf commented Nov 23, 2021

Now available in the v5.6.0 release

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

No branches or pull requests

3 participants