You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Previews with aspect ratio need to be properly cached #13516
Currently, the code in the Preview class contains this in the isCachedBigger() method:
// in order to not loose quality we better generate aspect preserving previews from the original file
if ($this->keepAspect) {
return false;
}
and even if this is commented out, the class will never return a cached copy of a preview if the client is asking for a smaller preview which keeps the aspect ratio as the code further down doesn't look for it.
Why is this a problem?
Let's say you're storing a 25MB TIFF and want to see it full screen via the Gallery app.
The app asks for a 1233x1487 preview and 30 seconds later the cache stores it as 1233-1487-with-aspect.png.
Now resize your screen slightly and ask for a full screen preview again.
You'll have to wait the full 30 seconds again to get a 932-1487-with-aspect.png preview
Multiply this scenario by the number of window configurations which are going to be used to watch a large screen preview and that thumbnail folder is going to get filled with a lot of similar previews and a lot of CPU cycles is going to get wasted.
Next steps
What's the problem with resizing a cached "with-aspect" preview?
And is there documentation somewhere regarding some of the design decisions which has been made regarding resizing and caching? For instance, on a few occasions, only width < maxX is checked. Is that because previews are expected to be square within OC core?
The dimensions of the preview may not match maxX and maxY. So we have a 700x350 preview stored as 1233x1487-with-aspect
maxX and maxY are based on the window size, so with today's variety of screen dimensions, this leads to many different aspect ratios and comparing them will often fail
Activity
georgehrke commentedon Jan 20, 2015
cc'ing @icewind1991 as he introduced the '-with-aspect' name-scheme for gallery
oparoz commentedon Jan 20, 2015
And is there documentation somewhere regarding some of the design decisions which has been made regarding resizing and caching? For instance, on a few occasions, only
width < maxXis checked. Is that because previews are expected to be square within OC core?oparoz commentedon Jan 20, 2015
OK, 2 reasons this is failing are:
oparoz commentedon Jan 20, 2015
I had a look at the process and there are 2 solutions to the window resizing problem:
It's possible to combine both for maximum effect.
I still don't know why it's bad to resize a "with-aspect" preview.
oparoz commentedon Jan 22, 2015
I'm marking this as a duplicate of #12465 since solving that problem will make this one less relevant.
The potential fix is in #13674
Having size categories can be another issue and PR.