Why is preview pre-generation not a built-in feature?

I’m using NC since some time now and am generally happy with it as a premium-support OS product. However there is one shortcoming that caused like 90% of my troubles with it: there is just no built in way to generate file previews, and the app that handles this is not that super well maintained and has lots of quirky bugs.

My wild guess would be that NextCloud is mostly used as a remote file browser by everyone (despite all the apps and org features) and this is almost impossible to use without fast (preexisting) previews. I have a rather powerful 4 core server, but if you open a folder with 100+ images, you have to wait a minute until you can browse the image previews - and again if you switch a folder. This makes image browsing use case almost impossible to use by default, without pregenerated previews.

Since this is so much core functionality - also since its possible ties with file handling, change watchers etc - why isn’t there a well-maintained implementation within Nextcloud for this?

Hi @poisonborz ,

Yes, the preview generation is currently a big problem as I see it, too.
Because 1. the in Nextcloud built-in preview generator that generates them on the fly doesn’t scale well and has performance problems. Because of that it is recommended to run the previewgenerator app and produce previews of all images beforehand. But in setups with many images this will take a long time an produce a lot of thumbnails (on my instance e.g. 50GB) which is because of that not perfect, either.

The biggest problem of the built-in preview generator that creates them on the fly is, that as you have found, you will need to wait a long time until you can browse the fotos (e.g. a minute). In my testing this is because it simply maxes out the CPU with new PHP processes until all previews that you’ve requested while opening a folder are generated so that your instance is not even able to e.g. open the viewer app while those are generated because there is no more CPU available for other things.

How to solve that in my opinion would be to limit the max number of concurrent preview generations which in my testing successfully limits the CPU load and hence allows to do other things in Nextcloud also as long as those previews are generated because your instance is then able to do other things because of enough available CPU.

Here you can find the Pull-Request: Limit number of concurrent preview generations by dbw9580 · Pull Request #18210 · nextcloud/server · GitHub
Unfortunately it didn’t get much attention by the Nextcloud team, yet.

Cheers!

I had a look at the Merge Request, it really looks like the only thing that is missing is one of the project’s dev approval right?

NC’s preview generation has always been a pain point in all deployments I had to do and this seems to fix one of the main issues.

Though, an embedded / integrated thumbnail generation at file upload/update might be another way to solve the issue…

1 Like

And you can move this folder to SSD, that makes preview random access much much much more efficient.

Not everybody are enabling previews, especially due to the fact that you always under security risk when you generate previews. So making it part of the core will be not good idea.

It is already on a SSD. I just don’t like the huge amount of unnecessary folders and files it produces

Actually the on the fly preview generation is already part of the core software (only the previewgenerator app isn’t)

This is just part of it. Files not explicitly uploaded - like external drives should also be covered. That’s why something like a toggleable cron job (with proper warnings about size, performance, security) would be better.

Without pre-generated previews, even mid sized Image folders are a pain to browse currently. This is a core concern. When properly informed, the user can make the choice himself.