I have created a view to get the all images that I have used in the website. But it returns as a bulk list. But I have saved the images according to a folder structure. How do I get the images according to a folder structure in my view.

Below is my view

enter image description here

Currently it returns a bulk list. How do I get the images with the folder structure?

For an example I need to get the /path1/path2/image.jpg inside a folder named path1 which contains a folder named path2.

  • 1
    By concept views are always flat lists. You cannot generate tree structures with views.
    – Hudri
    Jan 14 '19 at 11:15

The feature "Group by field" provides a hierarchy, but you don't have the path components out of the box.

Are you using a module that is controlling the paths that is also integrated with views, maybe File field paths? If you can get a field to display a path component you will be able to group by them, effectively getting a folder structure.

Views tree also helps, if you have the path components.

This comparison list might help: File Uploading and Managing.

If no module provides this already you'll have to create your own Views Field formatter for the file URL link field and use with some hierarchy mentioned above, or create a completely new Views Format for the File Views type that displays results in a hierarchy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.