Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview cache issue #8483

Closed
PhieF opened this issue Feb 21, 2018 · 7 comments
Closed

Preview cache issue #8483

PhieF opened this issue Feb 21, 2018 · 7 comments

Comments

@PhieF
Copy link
Contributor

PhieF commented Feb 21, 2018

I'm using previewgenerator app to pre-generate my thumbnails however I'm encountering an issue that could come from the preview engine.
in
private/Preview/Generator.php

we have

try {  
    $preview = $this->getCachedPreview($previewFolder, $width, $height, $crop, $maxPreview->mimeType);

  } catch (NotFoundException $e) {
          $preview = $this->generatePreview($previewFolder, $maxPreview, $width, $height, $crop, $maxWidth, $maxHeight);

}

I've added the same

$preview = $this->getCachedPreview($previewFolder, $width, $height, $crop, $maxPreview->mimeType);

after generatePreview
Here, getCachedPreview should have been able to find a preview, however it still can't find a cached preview.
It seems the problem comes from "$maxPreview->mimeType" which I don't understand the purpose, why shouldn't it be "$mimeType"
?

Thank you

@MorrisJobke
Copy link
Member

cc @rullzer

@rullzer
Copy link
Member

rullzer commented Feb 21, 2018

It has to be the mimetype of the preview. For example consider you are making an preview for some MP3 file that has album data in it. The resulting preview will be a jpeg or png. But the mimetype of the file is that of an mp3 file (audio/mpeg ??).

Do you have an example image that you see this behaviour with? As I can't trigger it locally.

@PhieF
Copy link
Contributor Author

PhieF commented Feb 22, 2018

Hi,

an example would be this one
https://nextcloud.phoenamandre.fr/index.php/s/W5RiEp35d8LQENA
which would raise this kind of exception

OCP\Files\NotFoundException: /appdata_ocy1zr9xjp8r/preview/36128/192-128.png in /var/www/html/nextcloud/lib/private/Files/Node/Root.php:202

here is what I have in this folder

1024-1024-crop.jpg
1116-1116-crop.jpg
128-85.jpg
192-128.jpg
256-256-crop.png
32-32-crop.png
512-342.jpg
64-43.jpg
767-512.jpg
1024-1024-crop.png
128-128-crop.jpg
1534-1024.jpg
256-171.jpg
32-21.jpg
384-256.jpg
512-512-crop.jpg
64-64-crop.jpg
96-64.jpg
1024-683.jpg
128-128-crop.png
1672-1116-max.png
256-256-crop.jpg
32-32-crop.jpg
48-32.jpg
512-512-crop.png
64-64-crop.png

so a lot of things, but not the asked preview

I was wondering, do we have a max cache size somewhere ?

@rullzer
Copy link
Member

rullzer commented Feb 23, 2018

Ah Mmm I think this is caused by a bug that is fixed recently. Does this also happen for newly uploaded files?

@PhieF
Copy link
Contributor Author

PhieF commented Feb 23, 2018

I don't know for newly uploaded files, I will try, thanks ! Fixed and released ? I'm on beta channel
Well it seems I have the latest commit

@MorrisJobke
Copy link
Member

I don't know for newly uploaded files, I will try, thanks ! Fixed and released ? I'm on beta channel
Well it seems I have the latest commit

@rullzer Do you know by any chance if this is already released?

@rullzer
Copy link
Member

rullzer commented Feb 26, 2018

Ah yes it is in 13. The issue was that we always saved a file as png. While it not always is a png. This caused some browsers to not play nice.

This looks like the leftovers of that. I'll think if I can come up with a way to clean this all up properly :S

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants