nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.56k stars 4.08k forks source link

Preview Provider returns previews larger than specified size #37142

Open gmeks opened 1 year ago

gmeks commented 1 year ago

⚠️ This issue respects the following points: ⚠️

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?

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

strech345 commented 1 year ago

Same for me. In list view and grid view it loads the image in 1024 width. Use chrome NC 26.0.1 running in docker using linuxserver/nextcloud Parameter x and y of request are always 500. 100 might be enough