Media site on Grav

I’ve just discovered Grav, and I’d like some insight from the developers regarding media;
Right now media is scanned only from the root folder of a page. I wonder how much work it would be to scan a directory with multiple subdirectories. eg.: media/ - media/video,media/audio,media/images …

Because we have a large existing media archive, and if media could be discovered in subdirectories, we could migrate to Grav quite easily, I think, from what I learned about looking at Grav so far.

Another question: Is Grav suitable to handle thousands of pages with alot of media files (30 GB + total)?

This CMS looks really promissing.

On second thought, that would be 300 pages to start with, growing at 50 to 100 pages / year.

You are welcome, all cms file flat based not have any limitation about number of pages, I think is possible without huge problem you need only good sd hd i think.
Relative to media scanning, you can access to children folders when you need:

But the best way is waiting the core developers for this.

Thank you;
this returns null however: {{ dump( ) }}
(master branch)

You probably mean the sub folders must be subpages? My question was whether it’s possible to access sub folders that only hold media items and nothing else. But ok, I’ll try this out, thanks.

A couple of things I want to mention:

  1. Right now about 1000 pages is the upper limit of what Grav will handle. Of course faster hardware (processor/ssd/memory) and also software (webserver/caching/etc) can make a big difference too. Grav can be optimized to not check for page changes, and this becomes essential on large sites. Also there currently is a static-cache plugin that effectively turns grav into a staticly served site, and makes it fast. We do have plans to revisit the ‘scalability’ and performance of Grav for large sites in the coming year.

  2. Every ‘folder’ underneath pages/ is considered a page in Grav. Even if it has no markdown file in it. This feature allows you to have a user/images/ folder for example, and put images in there, and still make use of Grav’s media functions by accessing the images page, and then in turn the images.

  3. You could create a folder underneath each page for each media type. This would mean you would have to find the page first, then access its media, as the media would not be available directly in the main pag e sitting above the media. However, this is going to increase your overall page-count considerably, as each page could potentially have 4+ media child pages.

  4. Grav already groups media into distinct types (images, videos, files). And it automatically does that for all media found in the current folder for the page. For Grav to work optimally, you would be better off putting all the media in the page folder, and use a consistent naming structure to ensure they were manageable. eg image-foo.jpg, image-bar.jpg, video-foo.avi, video-bar.avi, that kind of thing…

Any code examples for this: “This would mean you would have to find the page first, then access its media, as the media would not be available directly in the main page sitting above the media” ?

Say for example you put all images in user/pages/media/images and all videos in user/pages/media/videos you could do something like:

{% set image_a_resized = page.find('/media/images').media['image_a'].cropResize(800,600) %}
{% video_x = page.find('/media/veidos').media['video_x'] %}

This is assuming you want to be able to manipulate them. If you simply wish to link to them and not even bother using the media capabilities of Grav, you can just put them outside of the user/pages folder structure and link to them as you would a regular image, video with standard HTML.