Regenerate preview for specisic pathes

We share a lot of image files from our smb/cifs share through nextcloud. So, we faced a problem, that users update files at smb storage keeping the same filename. That results that the new image (with old filename) is available by the nextcloud, but nextcloud shows the old preview (thumbnail).
Is there a way to solve the problem?
As I understand - there is no way to start previewgenerator for specific path. There is no sense to start it for all storage as it is millions of files and it may take weeks to refresh previews…

I have no solutions for you.

But i think it is a bug. Maybe you can write an issue.

If I had written the software, I would have compared the date of the original image with the date of the preview/thumbnail. Of course, if the original image is newer, I would recreate the preview/thumbnail because if not the preview/thumbnail is totally useless and it compromises the integrity (shown preview vs. original).

I have not tested it. Maybe in some environments it works correctly.

Maybe someone knows more about this.

What about using the ./occ preview:generate-all ... command?

as I already wrote - there too many files and it’ll take weeks to finish.
Anyway, I started it
sudo -u nginx php ./occ preview:generate-all -vvv
but it failed in a day with memory allocation error.
That’s why, I asked a way to generate previews for a specific folder or any other way to refresh them.

From nextcloud/previewgenerator README.md
preview:generate-all [--path=PATH ...] [user_id ...]

Thank you!
Now I know where the apps are stored and their readme.md!
Just I am a bit confused - the files I need preview for is from external smb share. How can I pass them to preview generator? If I made preview for single user, that uses them do other will see new previews also?

How can I pass them to preview generator?

  1. Mount SMB share in External Storage Support app (How to)
  2. Run occ files:scan command (How to) with -v option and see how Nextcloud constructs path for SMB shares.
  3. Use the required path from the previous step to generate previews.

If I made preview for single user, that uses them do other will see new previews also?

I don’t have an exact answer, but the rate of generating previews for the first user is much lower than for the second and subsequent ones. Therefore, it can be assumed that the previews are associated with SMB share path, and not with path to particular user files.

Thank you. Will try.

@Snufkin @j-ed @Alex_the_G

I don’t understand why the app Preview Generator is mentioned. It is only there to generate the images beforehand. It has nothing to do with the problem.

I think it is a bug. If the preview is outdated, Nextcloud should automatically detect and replace it. Nobody needs an additIonal app. The app can not solve the problem.

1 Like

well, I reruned preview generator for some times, but this doesn’t give any result. The previews are old version files and the file content is another.
image_as_is
prebiew

I have no idea how to solve the problem…

I reruned preview generator for some times, but this doesn’t give any result.

In order for preview generator to find updated files, you must first update Nextcloud file database. This can be done in one of two ways:

  1. manually with occ files:scan command just before generating previews.

  2. automatically using SMB update notifications. Pay attention to how to decrease sync delay.

The previews are old version files and the file content is another.

The same error exists in desktop Windows 10 operating system. If your image editor keeps file attributes unchanged (creation and modification time), then thumbnails are not updated in Windows File Explorer.

Thank you. will try soon and report the result

I tried 1st way. And got no result.
sudo -u www php ./occ files:scan --path /YYYY/files/Design/“СГ НОВЫЕ ПРОЕКТЫ”/УМКА/04_KV
Starting scan for user 1 out of 1 (YYYY)
±--------±------±-------------+
| Folders | Files | Elapsed time |
±--------±------±-------------+
| 1 | 9 | 00:00:00 |
±--------±------±-------------+
[root@data nextcloud]# sudo -u www php ./occ preview:generate-all -vvv --path /YYYY/files/Design/“СГ НОВЫЕ ПРОЕКТЫ”/УМКА/04_KV
2022-09-17T18:43:33+03:00 Scanning folder /YYYY/files/Design/СГ НОВЫЕ ПРОЕКТЫ/УМКА/04_KV
2022-09-17T18:43:33+03:00 Generating previews for /YYYY/files/Design/СГ НОВЫЕ ПРОЕКТЫ/УМКА/04_KV/UM_KV_01_HOR.jpg
2022-09-17T18:43:33+03:00 Generating previews for /YYYY/files/Design/СГ НОВЫЕ ПРОЕКТЫ/УМКА/04_KV/UM_KV_01_VERT.jpg
2022-09-17T18:43:33+03:00 Generating previews for /YYYY/files/Design/СГ НОВЫЕ ПРОЕКТЫ/УМКА/04_KV/UM_KV_02_HOR.jpg
2022-09-17T18:43:33+03:00 Generating previews for /YYYY/files/Design/СГ НОВЫЕ ПРОЕКТЫ/УМКА/04_KV/UM_KV_02_VERT.jpg

The second results in error messages:
sudo -u www php ./occ files_external:notify 26 -v
Error while running self-test, no changes detected

:frowning:

I’m facing the same issue. None of the things above work. I submitted a different topic before I found this one but no one has replied. This is making nextcloud unusable for me. When I take photos from a trip we quickliy export all of them from lightroom but later after editting I reexport and none of the changes ever show. I can’t believe such a simple thing is broken. if the preview is older than the file it should not be used.