Skip to content

[Bug]: Max sized preview gets generated, regardless of specifications #518

@marco-calautti

Description

@marco-calautti

⚠️ This issue respects the following points: ⚠️

Bug description

It seems that when a preview generation is triggered, e.g., using the preview generator app, regardless of the given specification, the generatePreviews method always generates the maxPreview with resolution using the max possible, according to the preview_max_x and preview_max_y parameters.

This is definitely undesirable, as it defeats the whole point of having small pre-generated previews, while having large on-demand previews, when needed. In fact, in the current state, the max preview is going to take the same space as the original picture in most cases, and thus, it does not make sense to pre-generate it.

The affected line of code is here.
In particular, the function getMaxPreview will generate the max preview, if it is not found, but this should not happen, if the specification parameter does not require this preview to be generated.

Steps to reproduce

  1. Trigger preview generation with the preview generator app specifying only, e.g., 64 256 as sizes
  2. Look for previews in the data/app_xxx/preview/ folder and see they are generated at max resolution, regardless of the 64 256 specification

Expected behavior

Only previews of the specified size are generated, while other previews of larger size (up to the max specified in the config) are only generated on-demand.

And before anyone tries to say this, no, reducing the value of the preview_max_x/y parameters is not a solution as this will also force the on-demand generation of previews to be capped at that value, which is also undesirable, as this will make fullscreen pictures in the Photo app to be rendered at a low resolution, while in this case, it is desirable to get a preview at the maximum resolution possible: either the one specified in the preview_max_x/y parameter, or if they are not set, the closest to the screen resolution.

Nextcloud Server version

30

Operating system

Other

PHP engine version

PHP 8.3

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions