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

Limit the generated image dimension combinations #529

Open
nenatap opened this issue Dec 10, 2024 · 2 comments
Open

Limit the generated image dimension combinations #529

nenatap opened this issue Dec 10, 2024 · 2 comments

Comments

@nenatap
Copy link

nenatap commented Dec 10, 2024

How to use GitHub

  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Feature request

**Which Nextcloud Version are you currently using: 29

Is your feature request related to a problem? Please describe.
I use nextcloud to store my photos. There is gazillion of them and because of that, I've stored them to S3 storage account. The problem comes when accessing the directories containing the images. My nextcloud instance starts generating the previews. The generation causes responsiveness issues because: a) I'm running a VM with low end CPU b) the latency between my VM and the S3 storage and C) lots of images in the directory (they are grouped by month).
Now, this sounds exactly like a probmlem which preview generator has been made to solve.
EXCEPT:
It creates a lot of unnecessary files that I could just fine live without. Those files eat all my available (local) file space. I just want to have the minimum previews pre-generated, that is 64x64 and 256x256.

I've configured the system with:
occ config:app:set --value="64 256" previewgenerator squareSizes
occ config:app:set --value="" previewgenerator squareUncroppedSizes
occ config:app:set --value="" previewgenerator widthSizes
occ config:app:set --value="" previewgenerator heightSizes

Yet there appears to be files such as 2048-1536-max.jpg, 480-640-max.jpg, (basically anything XXXX-YYYY-max.jpg)

Describe the solution you'd like
I would like to have an option to disable the pre-generation of the *-max.jpg (or .png etc) files, thus saving a lot of space (and resources). Having (small) thumbnails available when browsing ancient directories will make the browsing experience better and if needed (ie. clicked on), then the nextcloud instance can create the requested image to generated at higher resolution.

@st3iny
Copy link
Member

st3iny commented Dec 28, 2024

Thanks for the report.

Since ea7d196, the app shouldn't generate previews for sizes that are specified as empty strings (like you did).

Please keep in mind that the app will not prevent the generation of previews through other means. E.g. if you browse through your files in the browser, on Android or any other Nextcloud app, additional previews will be requested.

Please check if those previews are really generated by the app and not through another app. You could investigate existing previews, upload some files, run pre-generate and check which new files/previews have been created.

@nenatap
Copy link
Author

nenatap commented Dec 30, 2024

Not totally sure if I understand correctly how things are in github, but I assume the fix/commit you refer to is active in 5.7.0 of image pregenerator.

Also If I understand correctly what you state above, then I think there is something broken here. Ie. I've just modified nextcloud config to set the max preview size to 1256px x 1256px. Then I ran the preview generation against a dir for which I knew didn't have any previews generated for. Then I checked for newly generated previews on filesystem and there are previews available for images larger than 256 x 256 .

[bash]:~/nextcloud/app/data/appdata_ocgb9u5nam2n#>grep preview ~/nextcloud/app/config/config.php
  'enable_previews' => true,
  'preview_max_x' => 1256,
  'preview_max_y' => 1256,
[bash]:~/nextcloud/app/data/appdata_ocgb9u5nam2n#>docker exec -it -u www-data nextcloud-app bash                                          
www-data@9c0961cf5bd9:~/html$ php occ config:app:set --value="64 256" previewgenerator squareSizes
Config value were not updated
www-data@9c0961cf5bd9:~/html$ php occ config:app:set --value="" previewgenerator squareUncroppedSizes
Config value 'squareUncroppedSizes' for app 'previewgenerator' is now set to '', stored as mixed in fast cache
www-data@9c0961cf5bd9:~/html$ php occ config:app:set --value="" previewgenerator widthSizes
Config value 'widthSizes' for app 'previewgenerator' is now set to '', stored as mixed in fast cache
www-data@9c0961cf5bd9:~/html$ php occ config:app:set --value="" previewgenerator heightSizes
Config value 'heightSizes' for app 'previewgenerator' is now set to '', stored as mixed in fast cache
www-data@9c0961cf5bd9:~/html$ php /var/www/html/occ preview:generate-all --path="/nenatap/files/BackBlaze-Cloud/Photos/2018/11"
2024-12-30T11:52:04+00:00 Scanning folder /nenatap/files/BackBlaze-Cloud/Photos/2018/11

[bash]:~/nextcloud/app/data/appdata_ocgb9u5nam2n#>find ./preview/ -type f -ctime -1 | tail -6
./preview/c/2/e/c/7/2/1/1165040/64-64-crop.jpg
./preview/c/2/e/c/7/2/1/1165040/256-256-crop.jpg
./preview/c/2/e/c/7/2/1/1165040/942-1256-max.jpg
./preview/8/9/6/4/a/a/6/1165043/64-64-crop.jpg
./preview/8/9/6/4/a/a/6/1165043/256-256-crop.jpg
./preview/8/9/6/4/a/a/6/1165043/942-1256-max.jpg

Note that I have not accessed the directory with browser, so all the previews here are generated by preview generator. Inclding the 942-1256-max.jpg files, which I was not expecting to find with this configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants