-
Notifications
You must be signed in to change notification settings - Fork 57
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
Generate only chosen sizes of previews #78
Comments
I looked into the commands, and I modified
But the max size generated keeps being 200 (the value I entered in config.php). How should I modify these functions? |
@rullzer Would you have any suggestion to help me out? Thank you in advance! |
Aaah well $maxW and $maxH should do the trick. The reason the bigger preview is generated is because that is how previews work in Nextcloud. From the original image we generate 1 'max preview'. Of the max sizes specified. That one is then used to generate all other previews from. This is done so we don't try to load 9MB pictures in RAM each time ;) |
Great, thank you! |
I don't know how Could it accept a third parameter? In this case, if the 2nd parameter doesn't exit, then it would use the 3rd parameter. Would it work? |
Nah it doesn't work like that. I'll look into this at some point. But I can't promise a timeline. |
Don't use PreviewGenerator with default settings if you have many image files. By default NC12 have max preview width&height 2048 px. With these settings PreviewGenerator generates 20(!) previews for each image. It is insane. At first it takes time, but more importantly – it inflates oc_filecache table twentyfold. The default logic how PreviewGenerator calculates sizes is factor by two from 32 px until reached max height/width. So it generates 3 sets (height, width, square) of previews with corresponding values: 2048, 1024, 512, 256, 128, 64, 32. It is 3x7-1(there is only one max size)=20 total. At first I've checked which sizes generates NC12 itself in common scenarios. There are 32x32 small square thumbnails, medium previews in Gallery view with image height of 256 px, squared 256px for folder previews in Gallery and large preview defined by max settings in config.php. From mobile browser there were additional sizes, but I'm focused on computer use now. I put max width 1500px, height 1000px in config.php and substitute preview size calculation with fixed values in PreGenerate.php and Generate.php.
Modified to:
So only 3 previews are generated: 32x32, ...x256, and max 1500/1000. |
Fixes #78 Signed-off-by: Roeland Jago Douma <[email protected]>
Thank you for this app!
I'd like to pre-generate only small previews of pictures, the ones used in a folder view for instance. And let the system generate larger preview when I ask for them. This would make the generation faster, and less space-consuming.
I tried to change these parameters in config.php:
It works well for the previewgenerator app. But it also prevents the system from generating larger preview when I click on it in the gallery for example. Would it be possible to chose which sizes can be pre-generated by the app?
This issue is related to #68 but the use case is not the same, so the solution could be different.
The text was updated successfully, but these errors were encountered: