Web & App shows wrong photos

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 25.0.13
Operating system and version (eg, Ubuntu 20.04): Debian 11 - 5.10.197-1
Apache or nginx version (eg, Apache 2.4.25): 2.4.56-1
PHP version (eg, 7.4): 7.4+76

The issue you are facing:
When opening photos in web view or within mobile app, the wrong photo is shown (as thumbnail and showing fully).
When the photo is downloaded or ‘save to gallery’ (within iOS mobile), the correct photo gets downloaded.
When looking at the photo on file level (meaning wthin /data//files/) directory on nextcloud server instance, the correct photo is shown.

I have already tried to recreate the previews using GitHub - nextcloud/previewgenerator: Nextcloud app to do preview generation in the background.
with the following commands

occ preview:repair --delete
occ preview:reset-rendered-texts
occ preview:generate-all

But the issue stays the same

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

I am sorry I do not know how to replicate this issue (on any other nextcloud instance).

The output of your Nextcloud log in Admin > Logging:

No related entries - just "Login failed" information due to wrong PW entry :)

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

CONFIG = array (
  'passwordsalt' => 'my_salt',
  'secret' => 'my_secret',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'nxtcloud-000001',
    2 => 'nxtcloud-000001.,mydomain.de',
    3 => 'nextcloud.mydomain.de',
    4 => '192.168.32.13',
    5 => 'mydomain1.myfritz.net',
    6 => 'mydomain2.myfritz.net',
    7 => 'cloud.mydomain.de',
    8 => '192.168.32.174',
    9 => '192.168.32.175',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '25.0.13.2',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'my_db_user',
  'dbpassword' => 'my_db_password',
  'installed' => true,
  'instanceid' => 'occ32aak10am',
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'skeletondirectory' => '/usr/local/share/nextcloud/skeleton',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'loglevel' => 2,
  'upgrade.disable-web' => 'true',
  'mail_from_address' => 'mydomain.de',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'gmail.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'mydomain.de',
  'mail_smtppassword' => 'my_db_password',
  'trashbin_retention_obligation' => 'auto, 45',
);

The output of your Apache/nginx/system log in /var/log/____:

[Sat Dec 09 00:00:01.790915 2023] [mpm_prefork:notice] [pid 1260] AH00163: Apache/2.4.56 (Debian) OpenSSL/1.1.1w configured -- resuming normal operations

[Sat Dec 09 00:00:01.790932 2023] [core:notice] [pid 1260] AH00094: Command line: '/usr/sbin/apache2'
[Sat Dec 09 09:15:28.269093 2023] [access_compat:error] [pid 2200675] [client 192.168.30.164:62106] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Sat Dec 09 16:57:43.003748 2023] [access_compat:error] [pid 2854519] [client 192.168.32.165:50114] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Sat Dec 09 17:10:29.750200 2023] [access_compat:error] [pid 2854579] [client 192.168.32.165:40342] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Dec 09 17:11:10.007994 2023] [access_compat:error] [pid 2881310] [client 192.168.32.165:55482] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Dec 09 17:11:35.919945 2023] [access_compat:error] [pid 2881360] [client 192.168.32.165:55100] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Dec 09 17:19:02.732087 2023] [access_compat:error] [pid 2881308] [client 192.168.32.165:33668] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Dec 09 17:34:37.916745 2023] [access_compat:error] [pid 2889937] [client 192.168.32.165:39522] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Dec 09 17:42:24.923592 2023] [access_compat:error] [pid 2889938] [client 192.168.32.165:42988] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"RSoxvO0X8NVginsM77xW","level":2,"time":"2023-12-09T16:12:04+00:00","remoteAddr":"192.168.32.165","user":"E91CD2C2-AABB-49C0-93E3-69BC4FEB2136","app":"user_ldap","method":"POST","url":"/index.php/login/confirm","message":"Bind failed: 49: Invalid credentials","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"25.0.13.2","data":{"app":"user_ldap"}}
{"reqId":"RSoxvO0X8NVginsM77xW","level":2,"time":"2023-12-09T16:12:04+00:00","remoteAddr":"192.168.32.165","user":"E91CD2C2-AABB-49C0-93E3-69BC4FEB2136","app":"user_ldap","method":"POST","url":"/index.php/login/confirm","message":"Bind failed: 49: Invalid credentials","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"25.0.13.2","data":{"app":"user_ldap"}}
{"reqId":"RSoxvO0X8NVginsM77xW","level":2,"time":"2023-12-09T16:12:04+00:00","remoteAddr":"192.168.32.165","user":"E91CD2C2-AABB-49C0-93E3-69BC4FEB2136","app":"core","method":"POST","url":"/index.php/login/confirm","message":"Login failed: 'myuser' (Remote IP: '192.168.32.165')","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"25.0.13.2","data":{"app":"core"}}

What is the wrong photo, something random, some different photo from the same folder? If there is only one photo in the folder, do you see a wrong thumbnail as well?
Did you put manually files in the /data folder (not via client, webdav, …)?

Went out of support in October (Maintenance and Release Schedule · nextcloud/server Wiki · GitHub). It’s not long ago, but apps align with NC versions as well, so some bugs might be already solved in newer versions.

Thanks for your reply :slight_smile:

Wrong photo means some random one.
Issue happens when there is only single photo in folder, too.

Yes - put some files in the /data folder but run

occ files:scan --all

afterwards.
Never the less it seems newly uploaded photos are not affected.

hm…interesting you are telling this version run out of support - my instance is showing up-to-date and does not provide possibility to update :confused:


Is there a way to force update?

Hi,

I remember two issues about something similar.

When clicking on photos with the same name the first photo will pop up · Issue #484 · nextcloud/viewer · GitHub (the initial report is different, but some people commented on they would be able to see photos from other people)

As explained in the viewer issue, previews are stored by their file id.

Currently, we don’t know how to reproduce such a situation. A misconfigured cache layer may cause something like that if the user session is not taken into account.

As a start you could check if the given url for the preview image matches the actual file id and if you have actually access to the preview you were seeing.

You should follow the steps as described under #i-want-to-resetregenerate-all-previews at the bottom of the page:

  1. Remove this folder:
    your-nextcloud-data-directory/appdata_<instanceid>/preview

  2. Optional: change parameters preview_max_x and preview_max_y in config.php (e.g., to 512), and change the previewgenerator app parameters heightSizes, squareSizes and widthSizes as per the README (or better yet, to a low value each, e.g. 512, 256 and 512 respectively)

  3. Run
    occ files:scan-app-data
    to reset generated previews in the database. (Important!)

  4. Run
    occ preview:generate-all [user-id]

After these steps the preview images should appear correctly again. (I hope!)

Much luck,
ernolf

1 Like

NC26 requires PHP 8.0 or newer, and you just have php 7.4. So you can upgrade like this before you do not use a newer version of php.

Thanks this resolved the issue completely :slight_smile:

1 Like

Thanks for your help - I will try to update my instance this week