nextcloud / previewgenerator

Nextcloud app to do preview generation in the background.
https://apps.nextcloud.com/apps/previewgenerator
GNU Affero General Public License v3.0
455 stars 57 forks source link

Preview generation and pre-generation of only images in a specific folder #410

Closed ostasevych closed 6 months ago

ostasevych commented 1 year ago

Hi! I have a need to create the thumbnails only for image files (png/jpeg/gif/bmp/tiff) in a specific folder. I have installed Imaginary in docker to make the preview generation easier (localhost @ port 9000). I use OnlyOffice in docker.

My config.php file includes the following preview generation settings:

'enable_previews' => true,
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\Image',
    1 => 'OC\\Preview\\TIFF',
    2 => 'OC\\Preview\\Imaginary',
  ),
  'jpeg_quality' => '60',
  'preview_concurrency_new' => '1',
  'preview_imaginary_url' => 'http://localhost:9000',

When I try to apply the initial generation ./occ preview:generate-all it creates thumbnails for office and pdf files, what I do NOT want the thumbnails are created. How to forbid explicitly generation of previews/thumbnails for office files?

When opening a folder nextcloud through Imaginary generates the thumbnails, what I do not want to have, but only for image files.

There's no documented way to generate and pre-generate settings to create thumbnails/previews ONLY for specific folders, but not the rest. The other method of placing .nomedia file where they are not needed is useless, as I have to place it everywhere in fact.

Please, suggest what to do to achieve my goals. Thanks!

joshtrichards commented 6 months ago

I use OnlyOffice in docker.

The previews are coming form OnlyOffice. I believe OO has an independent option to disable preview generation for document formats it is handling - i.e.

https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/ec8d49ac58ebf64f6cae2617742f9503400cd43e/templates/settings.php#L110

ostasevych commented 6 months ago

I use OnlyOffice in docker.

The previews are coming form OnlyOffice. I believe OO has an independent option to disable preview generation for document formats it is handling - i.e.

https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/ec8d49ac58ebf64f6cae2617742f9503400cd43e/templates/settings.php#L110

This is not related to OO.

joshtrichards commented 6 months ago

This is not related to OO.

Can you elaborate?

This is OnlyOffice's Preview provider: https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/master/lib/Preview.php

It registers itself to provide preview generation capabilities for the following formats:

https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/ec8d49ac58ebf64f6cae2617742f9503400cd43e/lib/Preview.php#L120-L151

These can only be disabled by toggling off previews in the OO Nextcloud app.