nextcloud / nextcloud/server

Preview Provider returns previews larger than specified size

Open
#37,142 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 25-feedback bug feature: previews and thumbnails
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.
Bug description
public const TEMP_FILE_DIMENSION = 2048;
$image = $this->previewProvider->getPreview($file, self::TEMP_FILE_DIMENSION, self::TEMP_FILE_DIMENSION);

Dimension of /tmp/oc_tmp_xD10UG-.jpg does not contain expected dimension requested 2048 ,returned dimensions 3072/4096
Dimension of /tmp/oc_tmp_F48MtH-.jpg does not contain expected dimension requested 2048 ,returned dimensions 3072/1728

The question becomes, why does getPreview give higher sized files. Is this a bug or excepted behavor?

It seems to work as aspected if you have TEMP_FILE_DIMENSION set to 1024

Discoussed more here: https://github.com/nextcloud/recognize/pull/718

Steps to reproduce

1.Call getPreview($file, self::TEMP_FILE_DIMENSION, self::TEMP_FILE_DIMENSION);

Expected behavior

Should return a file preview that either matches or is smaller in size.

Installation method

Community Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MariaDB

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
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.thexsoft.com",
            "cloudtest.thexsoft.com"
        ],
        "overwriteprotocol": "https",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/cloud.thexsoft.com",
        "dbtype": "mysql",
        "version": "25.0.4.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "NO",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "activity_expire_days": 365,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "appstore.experimental.enabled": "true",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpport": "2525",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "filelocking.enabled": true,
        "theme": "",
        "log_type": "file",
        "loglevel": 0,
        "logfile": "\/var\/ncdata\/nextcloud.log",
        "updater.release.channel": "stable",
        "maintenance": false,
        "has_rebuilt_cache": true,
        "app_install_overwrite": [
            "spreed",
            "social",
            "suspicious_login",
            "sentry",
            "documentserver_community",
            "maps",
            "carnet",
            "passwords"
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.local": "\\OC\\Memcache\\APCu",
        "mail_sendmailmode": "smtp",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "preview_max_memory": 512,
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/lib\/..\/exiftool-bin\/exiftool-amd64-glibc"
    }
}
List of activated Apps
Enabled:
  - activity: 2.17.0
  - admin_audit: 1.15.0
  - bookmarks: 12.0.0
  - bruteforcesettings: 2.5.0
  - calendar: 4.2.4
  - camerarawpreviews: 0.8.1
  - carnet: 0.24.6
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contacts: 5.1.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - deck: 1.8.3
  - event_update_notification: 2.0.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_fulltextsearch: 25.0.0
  - files_fulltextsearch_tesseract: 25.0.0
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - fulltextsearch: 25.0.0
  - fulltextsearch_elasticsearch: 25.0.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - mail: 2.2.4
  - maps: 0.2.4
  - metadata: 0.17.0
  - news: 21.0.0
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - passwords: 2023.3.20
  - photos: 2.0.1
  - previewgenerator: 5.2.1
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recognize: 3.6.1
  - recommendations: 1.4.0
  - related_resources: 1.0.4
  - richdocuments: 7.1.1
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - social: 0.6.0-beta1
  - spreed: 15.0.4
  - survey_client: 1.13.0
  - suspicious_login: 4.3.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - twofactor_email: 2.7.2
  - twofactor_totp: 7.0.0
  - twofactor_webauthn: 1.1.2
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - apporder: 0.15.0
  - audioplayer: 3.3.1
  - circles: 0.17.3
  - cookbook: 0.10.1
  - encryption: 2.6.0
  - facerecognition: 0.9.11
  - files_external
  - files_markdown: 2.3.6
  - integration_mastodon: 1.0.6
  - libresign: 6.2.8
  - memories: 4.11.2
  - openotp_sign: 1.3.4
  - quota_warning: 1.15.0
  - socialsharing_email: 2.5.0
  - support: 1.0.0
  - tasks: 0.14.5
  - user_ldap
  - video_converter: 1.0.5
Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Preview Provider getPreview($file, 2048, 2048) entry point and compare its behavior with the discussion in recognize pull request 718. Reproduce the reported 3072/4096 and 3072/1728 results, then trace how requested dimensions are handled. Done means previews match or remain below the requested dimensions, with regression coverage if the relevant test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.